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
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
After scratching through the net(this SO post), I added this in web.config:
<system.web>
<httpRuntime maxRequestLength="102400" executionTimeout="360"/>
</system.web>
This should have solved the issue.But it does not. Any help to solve the problem would be highly appreciated.