Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Maximum request length exceeded.

Reply
Thread Tools

Maximum request length exceeded.

 
 
Lloyd Dupont
Guest
Posts: n/a
 
      01-19-2006
I'm experimenting with an upload file page.
I have a few HtmlInputFile on it.

While testing it, I selected a 12MBfile, click "upload".
I was think I am safe as (at last in the code) I don't upload file bigger
than 1MB.

At the top of my request there is a module where I access the request and
while querying a parameter:
string var = context.Request["param"]

I get the following exception:
===
System.Web.HttpException was unhandled by user code
Message="Maximum request length exceeded."
Source="System.Web"
ErrorCode=-2147467259
StackTrace:
at System.Web.HttpRequest.GetEntireRawContent()
at System.Web.HttpRequest.GetMultipartContent()
at System.Web.HttpRequest.FillInFormCollection()
at System.Web.HttpRequest.get_Form()
at System.Web.HttpRequest.get_Item(String key)
at LangModule.HTranslate(Object sender, EventArgs e) in
f:\MyWork\eCookBook\WebSite\asp.net\App_Code\LangM odule.cs:line 36
at
System.Web.HttpApplication.SyncEventExecutionStep. System.Web.HttpApplication.IExecutionStep.Execute( )
at System.Web.HttpApplication.ExecuteStep(IExecutionS tep step,
Boolean& completedSynchronously)
===

What could I do to get around that?
I mean, I don't want to download 12MB file (I just skip the upload and write
a error status message) and I don't want them to cause my application to
fail....

Perhaps some Javascript?

--
I have taken a vow of poverty. If you want to really **** me off, send me
money.


 
Reply With Quote
 
 
 
 
Mark S. Milley, MCAD (BinarySwitch)
Guest
Posts: n/a
 
      01-19-2006
The default maximumRequestLength is 4 mb. While ASP.NET can handle much
larger files, MS recommends a 10-20 mb limit for the files.

If you're using ASP.NET 1.1, try sticking this in your web config file
(16mb limit) somewhere inside of <system.web>

<httpRuntime maxRequestLength="16384" />

See:
http://msdn.microsoft.com/library/de...imesection.asp

In ASP.NET 2.0, you can set this dynamically at the page level.

See:
http://msdn2.microsoft.com/en-us/lib...estlength.aspx

 
Reply With Quote
 
 
 
 
Lloyd Dupont
Guest
Posts: n/a
 
      01-19-2006
Thanks for the links Mark!

"Mark S. Milley, MCAD (BinarySwitch)" <(E-Mail Removed)> wrote
in message news:(E-Mail Removed) oups.com...
> The default maximumRequestLength is 4 mb. While ASP.NET can handle much
> larger files, MS recommends a 10-20 mb limit for the files.
>
> If you're using ASP.NET 1.1, try sticking this in your web config file
> (16mb limit) somewhere inside of <system.web>
>
> <httpRuntime maxRequestLength="16384" />
>
> See:
> http://msdn.microsoft.com/library/de...imesection.asp
>
> In ASP.NET 2.0, you can set this dynamically at the page level.
>
> See:
> http://msdn2.microsoft.com/en-us/lib...estlength.aspx
>



 
Reply With Quote
 
justin_yj justin_yj is offline
Junior Member
Join Date: Oct 2010
Posts: 1
 
      10-29-2010
In the Application_Event function of Global.ascx.cs file, put the following line:

Response.Close();

Then you will have your issue gone.

For more information about this, please read
justinyue.wordpress.com/2010/10/29/handle-the-maximum-request-length-exceeded-error-for-asyncfileupload-control/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to handle "Maximum request length exceeded" exception =?Utf-8?B?Y21heQ==?= ASP .Net 8 04-02-2012 04:20 PM
Catching Exception for "Maximum request length exceeded" Chris Hayes ASP .Net 8 10-21-2010 02:02 PM
Trap the Maximum request length Giuseppe Esposito ASP .Net 2 01-14-2006 07:41 AM
"Maximum request length exceeded" error seems to drop some Cookies and Session variables. Chris Hayes ASP .Net 0 07-27-2005 04:21 AM
Application_Error and Maximum request length exceeded Jacky Kwok ASP .Net 2 06-24-2005 08:24 AM



Advertisments