fileupload error - Internet Explorer cannot display the webpage - asp.net

I know this question has been asked in other threads, but none of the solutions provided could fix my problem.
When I upload a file greater than ~4MB (i.e. bigger than default), I get the "Internet Explorer cannot display the webpage" error. (Files smaller has no problems).
Here's what I've done so far:
1) Edited webconfig:
<httpRuntime maxRequestLength="20480" executionTimeout="3600" enable="true"/>
<customErrors mode="Off"></customErrors>
AND
<requestLimits maxAllowedContentLength="20000000000" />
2) Updated hosts file (C:\Windows\System32\drivers\etc\hosts) to remove line:
:: 1 localhost
3) Tested on IE, Chrome, and Firefox (all have the same issues).
4) Tried using IE's developer tools but not quite sure what to look for.
Would really really appreciate any advice/guidance on this! I've spent almost 2 days on this and still cannot figure it out. I gather it must be the file size issue (since I have load smaller files...)
THANKS so much!

Assuming that you have file upload control as follows:
<asp:FileUpload ID="flUpImg" runat="server"/>
when uploading is done you usually upload files to the server by clicking a button.
In that button click event check for
flUpImg.PostedFile.ContentLength
let xxxx be the value returned.
Note it down and stop debugging.
Go to web.config file and edit the following tag as
<httpRuntime maxRequestLength="value greater than xxxx"/>
where xxxx is the size of the uploaded files.

Two more things to look at:
1) Are you running UrlScan or some other IIS add-in? You can check through the IIS console by choosing your web-site and clicking ISAPI Filters. If so, check whether it too has an upload size limit that you need to override: e.g., C:\Windows\System32\inetsrv\urlscan\urlscan.ini, [RequestLimits], MaxAllowedContentLength=1073741824.
2) Check your global .config files: machine.config and root-level web.config in e.g. C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config (for 64-bit applications running .NET 4) for <system.web /> and applicationHost.config in C:\Windows\System32\inetsrv\config for <system.webServer /> in case there are any non-standard settings in there such as allowDefinition="MachineOnly" or allowOverride="false". I suspect this isn't the problem, as you would probably see some sort of message on the screen or in the application event log if it were; something else to tick off your list, though.

I was facing the same issue which got resolved by adding below in web.config under system.web.
<httpRuntime maxRequestLength="20480" executionTimeout="3600" enable="true"/>

The key is the maxRequestLength="20480" inside your <httpRuntime> tag. It's failing because the page is rejecting the file you're testing, which is evidently larger than 20MB. If you check the file you're testing you'll probably notice this.
Try setting this figure a lot higher and you will get some success!:
<httpRuntime maxRequestLength="51200" executionTimeout="3600" enable="true"/>

Related

how to set enableVersionHeader to false globally on IIS7

I've got several dozen sites that I wish to lock down running ASP.Net and part of the job is to turn off the bloody headers (saying what version of ASP.Net is running). This involves going to each and every web.config file and setting <httpRuntime enableVersionHeader="false" />
.
Is there any way to do this globally? The machine.config(s) , 4 in all, in IIS7 does not support enableVersionHeader="false" in the same httpRuntime tag.
Is there a special tag or section for this in the machine.config?
I wanted to add that <deployment retail="true" /> is another recommendation, but attempting to put that in the machine.config (under system.web) results in an error as well. (any ideas?)
Right now, I'm just going to put these in the web.configs, but it would be nice if MS would have this PCI mandatory feature inside IIS (a single typo in .config files can take a site or the entire server down - with such a popular request, you'd think they'd put this in the GUI!!!)
machine.config should have a webServer section and you should be able to set it there.
"You will need to add this configuration setting to each Machine.Config file inside the section.
<system.web>
<httpRuntime enableVersionHeader="false" />
.....
</system.web>
"
Reference: here
Since the enableHeader is FALSE it doesn't have to be mentioned at all.
Remove the entire element <httpRuntime enableVersionHeader="false" /> and try again

windows authentication error (only with a lot of data)

I have an ASP.net website running under IIS6. In one .aspx page the user has to enter data which is then stored into a database. The amount of data can vary. The project uses Windows Authentication.
So far everything worked, but once the data exceeds a certain amount, the website asks again for the credentials. When I click cancel a 401 error is returned, when I enter username/password a 12152 error (after some time of processing). I have tried it with IE6 and IE9 (also in IE8 mode).
Any ideas what could be done?
Sounds like an execution timeout, the default is 110 seconds. Try changing the executionTimeout and maxRequestLength attributes of the httpRuntime configuration.
<httpRuntime executionTimeout="1200" maxRequestLength="104856" />
After more than one month I was finally able to solve it: I had to increase the MaxHttpCollectionKeys-settings in the web.config file.
<appSettings>
<add key="aspnet:MaxHttpCollectionKeys" value="2000" />
</appSettings>
After this modification the error was gone.

Large file uploading

I want to upload a large file in asp.net app of visual studio 2010. But I have got connection reset error. How can I solve it? Thanks.
P.S I have changed the requestlimited in the webconfig which is not to be make any effect.
It's a security setting to limit the size of the request. It's a setting called RequestMaxLength in web config. I believe the default is 3 or 4 MB... An asp.net file upload will be limited by the number defined in this setting (any request for that matter).
<configuration>
<system.web>
<httpRuntime maxRequestLength="4096" executionTimeout="1200" />
</system.web>
</configuration>
It's not wise to make this a very large number because it exposes you to DOS attack since someone could just flood your server with huge files. There is also an executionTimeout property that might have to be set as well

asp.net - post file gives 404 page result even though posted file is well under maxRequestLength

I have a page on my ASP.NET site which uploads files.
I have attempted to tweak the web.config file to allow for larger uploads.
In my web.config, I set:
<httpRuntime maxRequestLength="2097152" executionTimeout="3600" />
On my page, when I attempt to upload smaller files, no issue...even at 25MB.
However, when I attempt to upload a 50MB file, I still get a 404 error page.
NOTE: I have a flash control on a different page which can upload almost 2gb with no issues, using this same web.config setting.
Same result on different PCs, same result when posted to different web servers.
My web server is Windows Server 2008 R2.
Any ideas of the cause? Why would flash be ok, but plain jane upload control have this problem?
I found the answer. Windows Server 2008 R2 is using IIS7 (of course), and in IIS7, you have to set the following in your web.config file (in my example to increase the limit to 2gb):
<system.webserver>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="2147483648" />
</requestFiltering>
</security>
<system.webserver>
This worked, when everything else didn't. IIS7 by default limits uploads to 30mb unless this override is set.
The executionTimeout applies only if the debug attribute in the compilation element is False. (see also http://msdn.microsoft.com/en-us/library/e1f13641.aspx)
So try it when starting your application in Release config.

FileUploader in asp.net MVC2

i am using fileuploader, i got its code from
http://www.codeproject.com/KB/aspnet/Implementing_HTTP_File_Up.aspx
and its working fine with small size files but its showing me bellow text when i try to upload a large file. my file size can be of 8-10 mb.:
The connection was reset
The connection to the server was reset while the page was loading.
* The site could be temporarily unavailable or too busy. Try again in a few
moments.
* If you are unable to load any pages, check your computer's network
connection.
* If your computer or network is protected by a firewall or proxy, make sure
that Firefox is permitted to access the Web.
please tell me what should i do.
You could try increasing the maximum request length in web.config:
<configuration>
<system.web>
<!-- The value is in KB -->
<httpRuntime maxRequestLength="4096" />
</system.web>
</configuration>
Alongside the answer Darin Dimitrov has given, you might also have to change the setting in iis for your web-application. If you are using Sharepoint, you need to configure it also in SCA.

Resources