HTTP错误400 - 错误的请求由于vb.net FileUpload控件 [英] HTTP Error 400 - Bad Request due to FileUpload control in vb.net

查看:258
本文介绍了HTTP错误400 - 错误的请求由于vb.net FileUpload控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Web表单(.NET框架4),其中包含一个提交按钮和一个FileUpload control.When我调试的网站从Visual Studio 2010,该表单显示为intended.When我上传文件大小> 438K(按我的最大文件大小的observations.Actual值是未知的,但对于大小200K的文件,它是工作),我收到以下错误上单击按钮。

I have a web form(.net framework 4) which contains a submit button and a FileUpload control.When I debug the website from visual studio 2010, the form appears as intended.When I upload a file with size > 438k(as per my observations.Actual value of maximum file size is unknown,but for file with size 200K, it is working),I get the following error on clicking the button.

Server Error in '/Dpp2012New' Application.
HTTP Error 400 - Bad Request.
Version Information: ASP.NET Development Server 10.0.0.0 

当我上载尺寸小于上述限制,code函数像往常一样的文件。
onclick事件处理程序codebehind是:

When I upload a file with size less than above limit, code functions as usual. The onclick event handler codebehind is:

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
    If FileUpload1.HasFile Then
        MsgBox("Has file!")
    End If
End Sub

通过网刮伤(<经过href=\"http://stackoverflow.com/questions/5936571/how-to-make-the-asp-file-upload-control-accept-large-files\">this SO后),我说这在web.config中:

After scratching through the net(this SO post), I added this in web.config:

    <system.web>
        <httpRuntime  maxRequestLength="102400" executionTimeout="360"/>
    </system.web>

这应该已经解决了issue.But没有。
任何帮助解决这一问题将是非常美联社preciated。

This should have solved the issue.But it does not. Any help to solve the problem would be highly appreciated.

推荐答案

请调试您的网站,并检查您是否连接到数据库?我想你没有连接。
如果您在上传大文件面临的一个问题,那么你必须将以下属性添加到您的webconfig文件。

Please debug your site and check whether you are connected to the database ? I think you are not connected. If you are facing a problem in uploading large files then you must add the following attribute to your webconfig file.

<system.web> 
<httpRuntime executionTimeout="110" maxRequestLength="20000" /> 
</system.web>

的maxRequestLength是最大文件大小。

maxRequestLength is the maximum file size.

更新答案:
在不同的浏览器,如谷歌Chrome,Internet Explorer中运行您的网站。

Updated Answer: Run your site on a different browser like google chrome, Internet explorer.

这篇关于HTTP错误400 - 错误的请求由于vb.net FileUpload控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆