Maximum request length exceeded.

Discussion in 'ASP .Net' started by Lloyd Dupont, Jan 19, 2006.

  1. Lloyd Dupont

    Lloyd Dupont Guest

    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\LangModule.cs:line 36
    at
    System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
    at System.Web.HttpApplication.ExecuteStep(IExecutionStep 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 piss me off, send me
    money.
    Lloyd Dupont, Jan 19, 2006
    #1
    1. Advertising

  2. 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/d...-us/cpgenref/html/gngrfhttpruntimesection.asp

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

    See:
    http://msdn2.microsoft.com/en-us/li...tion.httpruntimesection.maxrequestlength.aspx
    Mark S. Milley, MCAD (BinarySwitch), Jan 19, 2006
    #2
    1. Advertising

  3. Lloyd Dupont

    Lloyd Dupont Guest

    Thanks for the links Mark!

    "Mark S. Milley, MCAD (BinarySwitch)" <> wrote
    in message news:...
    > 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/d...-us/cpgenref/html/gngrfhttpruntimesection.asp
    >
    > In ASP.NET 2.0, you can set this dynamically at the page level.
    >
    > See:
    > http://msdn2.microsoft.com/en-us/li...tion.httpruntimesection.maxrequestlength.aspx
    >
    Lloyd Dupont, Jan 19, 2006
    #3
  4. Lloyd Dupont

    justin_yj

    Joined:
    Oct 29, 2010
    Messages:
    1
    This issue can be handled in Global.ascx file

    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/
    justin_yj, Oct 29, 2010
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jacky Kwok
    Replies:
    2
    Views:
    3,559
    Mark1969
    Jun 24, 2005
  2. =?Utf-8?B?Y21heQ==?=
    Replies:
    8
    Views:
    31,161
    SilentSojourner
    Apr 2, 2012
  3. Chris Hayes
    Replies:
    8
    Views:
    9,377
    DDaanV
    Oct 21, 2010
  4. Chris Hayes
    Replies:
    0
    Views:
    662
    Chris Hayes
    Jul 27, 2005
  5. =?Utf-8?B?Q2h1Y2sgUA==?=

    Unhandled Exceptions and Maximum request length exceeded

    =?Utf-8?B?Q2h1Y2sgUA==?=, Oct 31, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    490
    bruce barker
    Nov 1, 2007
Loading...

Share This Page