I have a similar problem. The file size limit is set high on our site, but I get timeouts if it takes longer than a couple of minutes to upload the file. Do not want to catch the error, but rather make a setting change to avoid it.
How do I write some errror checking code in my code behind to handle this error? Instead of keep increasing this number, I want to put out a friendly message to the user about the max size. How do I do that?
you can check the file lenght of the file that the user is trying to post to the server then display your message
try
{
if(fileToBeUploaded > constantMaximumFileSize)
{
//display your pretty message here
messageLabel.Text = "Hey! You can't upload a file more than " +
+ constantMaximumFileSize;
}
else
{
//do your upload code here
}
}
catch(HttpException httpEx)
{
//HttpExceptions is an exception that occurrs during the processing of HTTP requests
}
tuzojazz
Member
210 Points
61 Posts
Maximum request length exceeded
Jul 07, 2006 06:56 PM|LINK
Hi:
I created an asp.net to upload files.
My code is written in visual basic.net
When I try to upload a file bigger than my
maxRequestLength setting I get this exception:
(0x80004005): Maximum request length exceeded.
I can not catch the exception even using try-catch-finally
Is there a way to catch this exception?
Thanks!!
tuzojazz
Member
210 Points
61 Posts
Re: Maximum request length exceeded
Jul 07, 2006 09:26 PM|LINK
sorry the esception is
HttpException (0x80004005): Maximum request length exceeded.
vishwa
Member
161 Points
47 Posts
Re: Maximum request length exceeded
Jan 06, 2007 03:11 AM|LINK
You can find the answer on following link
http://www.vishwamohan.com/ShowArticle.aspx?ArticleID=18
My Web Site and Blog
erdsah88
Contributor
3453 Points
930 Posts
Re: Maximum request length exceeded
Jan 07, 2007 08:14 AM|LINK
Marian Kosta...
Participant
914 Points
191 Posts
Re: Maximum request length exceeded
Jan 13, 2007 09:36 AM|LINK
You can set maximum request length in web.config
<configuration> <system.web> <httpRuntime maxRequestLength="32768" /> </system.web> </configuration>aarenz
Member
12 Points
3 Posts
Re: Maximum request length exceeded
Feb 09, 2007 02:32 PM|LINK
I have a similar problem. The file size limit is set high on our site, but I get timeouts if it takes longer than a couple of minutes to upload the file. Do not want to catch the error, but rather make a setting change to avoid it.
ShailAtlas
Contributor
2269 Points
548 Posts
Re: Maximum request length exceeded
Feb 10, 2007 05:44 AM|LINK
mychucky
Contributor
4358 Points
3722 Posts
Re: Maximum request length exceeded
Apr 10, 2007 03:59 PM|LINK
How do I write some errror checking code in my code behind to handle this error? Instead of keep increasing this number, I want to put out a friendly message to the user about the max size. How do I do that?
keith.rull
Member
266 Points
55 Posts
Re: Maximum request length exceeded
Apr 10, 2007 06:48 PM|LINK
you can check the file lenght of the file that the user is trying to post to the server then display your message
try { if(fileToBeUploaded > constantMaximumFileSize) { //display your pretty message here messageLabel.Text = "Hey! You can't upload a file more than " + + constantMaximumFileSize; } else { //do your upload code here } } catch(HttpException httpEx) { //HttpExceptions is an exception that occurrs during the processing of HTTP requests }-
My Personnal Site | DevPinoy.org: A Filipino Developers Community
mychucky
Contributor
4358 Points
3722 Posts
Re: Maximum request length exceeded
Apr 10, 2007 07:53 PM|LINK