473,378 Members | 1,346 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

How to handle "Maximum request length exceeded" exception

I have changed my config files to set the limit for files being uploaded to
30 MB, but every now and then someone tries to upload a file larger than this.

All I want, is to be able to trap the error and tell the user what happened.

I can trap the error in the page_error (Page.Error) event, and I believe I
was also trapping it at the application_error level at one point.

My problem is, once I trap the error, I can't do anything to tell the user
what happened. If I try to display an error message in a asp.net label, or
response.write some text, or response.redirect them to another page, or just
set the errorPage property for the upload page to some URL, none of these
work.

When you upload a large file, the error is trapped correctly, and then the
browser shows the "Page cannot be displayed" message, no matter which of the
methods above I have tried.

Can anyone help me with this one?
Nov 19 '05 #1
2 4212
If the file is too large, an ugly error screen will be displayed to the user
and as far as I know there's nothing you can do about this without some kind
of thick client.

So to solve your problem, you might look into using a 3rd party activex
control such as this:
http://fileup.softartisans.com/fileup-231.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"cmay" <cm**@discussions.microsoft.com> wrote in message
news:25**********************************@microsof t.com...
I have changed my config files to set the limit for files being uploaded to
30 MB, but every now and then someone tries to upload a file larger than
this.

All I want, is to be able to trap the error and tell the user what
happened.

I can trap the error in the page_error (Page.Error) event, and I believe I
was also trapping it at the application_error level at one point.

My problem is, once I trap the error, I can't do anything to tell the user
what happened. If I try to display an error message in a asp.net label,
or
response.write some text, or response.redirect them to another page, or
just
set the errorPage property for the upload page to some URL, none of these
work.

When you upload a large file, the error is trapped correctly, and then the
browser shows the "Page cannot be displayed" message, no matter which of
the
methods above I have tried.

Can anyone help me with this one?

Nov 19 '05 #2
Steve,

Thanks for the reply.

I'm guessing that the reason I am not getting the normal ASP.NET error
page because I have error trapping at the page and application level.
So there is not an unhandled exception.

What I don't understand is why it seems like I can no longer relay
anything to the user once this error has occurred. I am wondering if
this is something to do with the nature of the exception, meaning that
the browser thinks it is still uploading the file (over the max amount)
while the server has already thrown the exception and stopped accepting
the upload?

I understand that this max input is put in place for security reasons,
but I can't believe that there is no way to display an error message to
the user, or direct them to an error page, in the event that they
exceed the maximum size for an upload.

If ASP.NET can give the user an ugly error page when this happens, I
should be able to give them a nice error page.

I understand that an ActiveX control would make this a lot easier, but
that is not an option for me for the obvious reasons.

Any idea where I can find more about this problem, or what I need to do
to give my users a nice error page?

Chris

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Big Dave | last post by:
Hello All, I was wondering wether anyone could help me solve what is probably a very easy issue. I keep getting this damn "The administrative limit for this request was exceeded" whenever I try to...
3
by: Jimski | last post by:
Hello all, I am having a problem where I get an error message when I call FlushFinalBlock when decrypting my encrypted text. I am using the Rijndael algorithm. The error message is "Length...
7
by: Dica | last post by:
i've used the sample code from msdn to create an encyption/decryption assembly as found here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetHT10.asp i'm...
11
by: Chris Hayes | last post by:
Greetings, I have an ASP.NET page that accepts input from an HtmlInputFile object. I have set the maximum size for HttpRequests to 2MB in the web.config file. And now I am trying to CATCH...
0
by: Chris Hayes | last post by:
I've seen that when an HTTP 400 error occurs ("Maximum request length exceeded") that some of my Session level variables and Cookies get "lost" is there a way to preserve them without resorting to...
2
by: TG | last post by:
I'm using the System.DirectoryServices.DirectorySearcher.Findall method to attempt to retrieve user id's from an Exchange LDAP server. I get the error message "The administrative limit for this...
0
by: Brian Pearson | last post by:
Hi, I'm wondering how I can find out when a request timeout has occurred and handle it programmatically. Here's is what I have so far: // This handler is added to the web application's...
2
by: ivancasher | last post by:
I´ve this warning in a php page "Maximum execution time of 30 seconds exceeded ", I´ve configurated the php.in, setting the value of max_execution_time = 1200, and then i restart the apache...
4
by: Kozman | last post by:
I have a problem where I need to use the literal "length" as a subscript in an associative array (I have no control over what is used as a subscript..."length" happens to be one of the uncontrolled...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.