asp出现堆栈溢出的解决办法
发布:阿智 日期:2007年11月7日
下午写程序的时候碰到了一个问题:堆栈溢出。。Request Object, ASP 0107 (0x80004005) 错误。。
上网查了下,原来是form传递数据时超过了系统限制的最大值,好象说win2000系统限制64K。。我用的就是2000的系统。这可怎么办呢?网上提供的解决办法有两个,一个是装什么组件,没写,所以不知道那组件的名字,而且如果用户用的是虚拟主机的话,装组件也不实际。另一个是,自己写程序,用JS把form要post的数据分割成几块小数据,然后再让程序自己整合。
经过两个小时的奋斗,终于解决了这个问题,哈~~ 现在把代码贴出来:
<!--#include file="Admin_IsLogin.asp" -->
<html>
<head>
<title></title>
<link href="Images/style.css" rel="stylesheet" type="text/css">
<SCRIPT Language=JavaScript>
function BreakItUp()
{
//Set the limit for field size.
var FormLimit = 102399
//Get the value of the large input object.
var TempVar = new String
TempVar = document.theForm.s1.value
//If the length of the object is greater than the limit, break it
//into multiple objects.
if (TempVar.length > FormLimit)
{
document.theForm.s1.value = TempVar.substr(0, FormLimit)
TempVar = TempVar.substr(FormLimit)
while (TempVar.length > 0)
{
var objTEXTAREA = document.createElement("TEXTAREA")
objTEXTAREA.name = "s1"
objTEXTAREA.value = TempVar.substr(0, FormLimit)
document.theForm.appendChild(objTEXTAREA)
TempVar = TempVar.substr(FormLimit)
}
}
}
</SCRIPT>
<body>
<%
if request.Form("html")="html" then
%>
<%
Dim s1
For I = 1 To Request.Form("s1").Count
s1 = s1 & Request.Form("s1")(I)
Next
conter=s1
set fs=server.CreateObject("Scripting.FileSystemObject")
FilePath=server.MapPath("../index.html")
set htm=fs.opentextfile(filepath,2,true)
htm.write conter
response.write"<script>alert('首页生成成功!');history.back();</script>"
end if
%>
<form method="post" action="creat_index.asp" onsubmit="BreakItUp()">
<p align="center">
<textarea rows="28" name="s1" cols="85"><!--#include file="../index.asp"--></textarea><br>
<input type="submit" value="生成首页" name="B1">
<input type="hidden" name="html" value="html"/>
</p>
</form>
<br>
</body>
</html>
Tags: asp 出现 堆栈 溢出 的 解决 办法
相关文章:经典代码 (2007-6-15 17:9:42)
Active Server Pages 错误 ASP 0201 的最终解决办法 (2007-6-1 9:53:33)
IE不执行js脚本的解决方法 (2006-7-6 9:49:22)
ASP 系列函数大全4 (2006-5-31 14:45:48)
ASP 系列函数大全3 (2006-5-31 14:43:28)
ASP 系列函数大全2 (2006-5-31 14:42:13)
ASP 系列函数大全1 (2006-5-31 14:39:36)
订阅
上一篇
下一篇
www.swissworld.org