使用FileUpload控件上传文件时对文件大小的限制

使用FileUpload控件上传文件时对文件大小的限制可以在配置文件中配置。具体配置在System.Web配置节中中添加
<httpRuntime maxRequestLength="10240"/>
即可。具体对上传文件大小限制只要修改maxRequestLength的值就可以了。

maxRequestLength:指示 ASP.NET 支持的最大的上载文件的大小。该限制可用于防止用户向服务器张贴容量过大的文件而导致拒绝服务。所指定的大小以 KB 为单位。默认值为 4096 KB (4 MB)。
posted on 2007-06-18 18:00  Edwin dong  阅读(4923)  评论(1编辑  收藏  举报

<% Function googleColor(value, random) Dim colorArray colorArray = Split(value, ",") googleColor = colorArray(random Mod (UBound(colorArray) + 1)) End Function Function googleScreenRes() Dim screenRes, delimiter, resArray screenRes = Request.ServerVariables("HTTP_UA_PIXELS") delimiter = "x" If IsEmpty(screenRes) Then screenRes = Request.ServerVariables("HTTP_X_UP_DEVCAP_SCREENPIXELS") delimiter = "," End If resArray = Split(screenRes, delimiter, 2) If (UBound(resArray) + 1) = 2 Then googleScreenRes = "&u_w=" & resArray(0) & "&u_h=" & resArray(1) End If End Function Function googleDcmguid() Dim dcmguid dcmguid = Request.ServerVariables("HTTP_X_DCMGUID") If Not IsEmpty(dcmguid) Then googleDcmguid = "&dcmguid=" & dcmguid End If End Function Dim googleTime, googleDt, googleScheme, googleHost googleTime = DateDiff("s", "01/01/1970 00:00:00", Now()) googleDt = (1000 * googleTime) + Round(1000 * (Timer - Int(Timer))) googleScheme = "http://" If StrComp(Request.ServerVariables("HTTPS"), "on") = 0 Then googleScheme = "https://" googleHost = Server.URLEncode(googleScheme & Request.ServerVariables("HTTP_HOST")) Dim googleAdUrl, googleAdOutput googleAdUrl = "http://pagead2.googlesyndication.com/pagead/ads?" &_ "ad_type=text_image" &_ "&channel=" &_ "&client=ca-mb-pub-6539345765131754" &_ "&dt=" & googleDt &_ "&format=mobile_single" &_ "&host=" & googleHost &_ "&ip=" & Server.URLEncode(Request.ServerVariables("REMOTE_ADDR")) &_ "&markup=xhtml" &_ "&oe=utf8" &_ "&output=xhtml" &_ "&ref=" & Server.URLEncode(Request.ServerVariables("HTTP_REFERER")) &_ "&url=" & googleHost & Server.URLEncode(Request.ServerVariables("URL")) &_ "&useragent=" & Server.URLEncode(Request.ServerVariables("HTTP_USER_AGENT")) &_ googleScreenRes() &_ googleDcmguid() Set googleAdOutput = Server.CreateObject("MSXML2.ServerXMLHTTP") googleAdOutput.Open "GET", googleAdUrl, false googleAdOutput.Send Response.Write(googleAdOutput.responseText) %>