精品久久看,欧美成人久久一级c片免费,日本加勒比在线精品视频,国产一区二区三区免费大片天美,国产成人精品999在线,97理论三级九七午夜在线观看

當前位置:首頁文章首頁 IT學院 IT技術

關于ASP中大字段在Form中Post出錯的解析

作者:  來源:  發布時間:2011-6-28 11:35:38  點擊:

這篇文章將會介紹到關于ASP中大字段在Form中Post出錯的解析,希望對大家能夠有幫助。

我們在使用很多新聞系統的時候,都會發現一個問題,尤其是使用 HtmlEdit 從WORD文檔中直接拷貝文章(尤其里面有復雜表格和文字)的時候,提交會有一個錯誤發生。

"Request Object, ASP 0107 (0x80004005)"

很多編程人員都以為是 Access 數據庫備注字段64kb限制的問題,開始 icech 也以為是,但是后來用了其他新聞系統的 SQL 版本,同樣的問題發生了。因此我猜想,可能是瀏覽器的問題。但是 Form 表單使用的都是 Post 方式,應該和瀏覽器無關,那是什么原因呢?

程序出錯提示總是在 Request.Form(“xxx”)的地方,因此我判斷,可能是Request有大小的限制。然后就去MSDN上查找“ASP 0107 (0x80004005)”,果然是Request的問題。微軟的原文是這樣的。

PRB: Error "Request Object, ASP 0107 (0x80004005)" When You Post a Form

The information in this article applies t

Microsoft Active Server Pages

This article was previously published under Q273482

SYMPTOMS

When you post a large form field in Microsoft Internet Information Services 5.0, you may receive the following error message:

Error Type:

Request object, ASP 0107 (0x80004005)

The data being processed is over the allowed limit.

When you post a large form field in Microsoft Internet Information Server 4.0, you may receive the following error message:

Request object error 'ASP 0107 : 80004005'

Stack Overflow

/projectname/page.asp, line XX

The data being processed is over the allowed limit.

CAUSE

The size limit of each form field that is retrieved in the Request object is 102,399 bytes. The error occurs when you exceed this limit.

RESOLUTION

To resolve this problem, use one of the following methods:

Instead of reading form variable values with the Request.Form collection, use Request.BinaryRead (Request.TotalBytes), and parse the form values from the output of Request.BinaryRead.

Use a File Upload scheme, such as Microsoft Posting Acceptor.

Break the HTML form variables into multiple form variables before you submit the form. The 102,399 byte limit is for each form variable, so you can have multiple form variables of 102,399 characters or less. The following sample code illustrates this: WARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. Microsoft provides this code "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.

<FORM method=post action=LargePost.asp name=theForm onsubmit="BreakItUp()">

<Textarea rows=3 cols=100 name=BigTextArea>A bunch of text...</Textarea>

<input type=submit value=go>

</form>

<SCRIPT Language=java script>

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.BigTextArea.value

//If the length of the object is greater than the limit, break it

//into multiple objects.

if (TempVar.length > FormLimit)

{

document.theForm.BigTextArea.value = TempVar.substr(0, FormLimit)

TempVar = TempVar.substr(FormLimit)

while (TempVar.length > 0)

{

var objTEXTAREA = document.createElement("TEXTAREA")

objTEXTAREA.name = "BigTextArea"

objTEXTAREA.value = TempVar.substr(0, FormLimit)

document.theForm.appendChild(objTEXTAREA)

TempVar = TempVar.substr(FormLimit)

}

}

}

</SCRIPT>

The receiving Active Server Page (ASP) page reconstructs the variable:

<%

Dim BigTextArea

For I = 1 To Request.Form("BigTextArea").Count

BigTextArea = BigTextArea & Request.Form("BigTextArea")(I)

Next

%>

100 K的限制?微軟竟然來這一手!幸好他們自己給出了幾個解決方案,看一下上文可以知道,微軟提供了2種可行的方法:

第一種使用Request.BinaryRead (Request.TotalBytes),第二種使用分段上傳的方式,基于少更改程序的原則,我們采用第二種方式。但是在使用的過程中,icech無意中發現,直接使用

For I = 1 To Request.Form("BigTextArea").Count

BigTextArea = BigTextArea & Request.Form("BigTextArea")(I)

Next

來代替Request.Form("BigTextArea")竟然也能達到同樣的效果!驚奇!我想可能系統每次將100K的內容發送給Request,上段程序又在進行循環,因此達到了同樣的效果。

以上是icech解決問題的方法,現在新聞系統例如:喬客、動力、惠信比較好的系統也都存在這個問題,大家可以試著用這種方法來解決。

下面再給大家提供一個我在CSDN上發現的一個帖子,和我寫的異曲同工,解決了一樣的問題,方法也一樣,供參考:

如何在Form域中Post大于100K字節的數據????

以前在工作中遇到一個問題,當表單發送的數據量很大時,就會報錯。查閱MSDN了解到,原因是微軟對用Request.Form()可接收的最大數據限制為100K字節。

微軟建議用Request.BinaryRead()讀取表單數據,但由于這種方法讀出的是二進制數據,需要對讀出的數據逐字節進行分析,生成有意義的字符串(MSDN上的一段程序就是這樣寫的,但它并沒有考慮諸如標點符號等轉義字符需要進行特殊分析)。如果說這種方法對于純英文系統勉強可用的話,則對于中文系統來說就有極大的麻煩,因為漢字是用兩個字節表示的,而讀出的二進制數據本身并不能判斷是英文還是漢字(否則就不是二進制數據,而是字符串了^-^)。

相關軟件

相關文章

文章評論

軟件按字母排列: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
主站蜘蛛池模板: 国产图色| 久久国产精品麻豆映画 | 四虎精品影院4hutv四虎 | 国产免费高清在线精品一区 | 久久精品一区二区三区四区 | 亚洲永久免费 | 啦啦啦日本 | 乱人伦精品一区二区 | 国产精品深夜福利免费观看 | 国产区最新 | 鬼灭之刃第四季在线观看 | 四虎影视库国产精品一区 | 亚洲国产日韩综合久久精品 | 99伊人 | 久久免费精品视频 | 国产成人精品日本亚洲11 | 日本高清视频一区二区 | 久久就是精品 | 国产高清一级毛片在线不卡 | 七月丁香色婷婷综合激情 | 国产一级电影 | 久久久免费网站 | 视频二区在线 | 欧美色资源 | 男人天堂网2020 | 日韩欧美亚洲每日更新网 | 嫩草影院发布页 | 免费观看高清视频ww | www.激情 | 国产成人精品一区二区app | 精品福利视频导航 | 免费的看视频网站 | 中文字幕亚洲欧美日韩不卡 | www.日本免费| 久久久久亚洲 | 欧美日韩国产中文字幕 | 精品成人毛片一区二区视 | 成人免费一级片 | 国产一级精品毛片 | 一级毛片免费的 | 免费免播放器在线视频观看 |