Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8660651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:18:23+00:00 2026-06-12T16:18:23+00:00

I added this to my web.config file: <httpRuntime maxRequestLength=40960/> <!– Limit to 40 megabytes

  • 0

I added this to my web.config file:

<httpRuntime maxRequestLength="40960"/> <!-- Limit to 40 megabytes -->

And when I try to upload something bigger than 40 megabytes, I get this in Firefox:

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.

Is there some way to also benefit from this built in file size limitation but actually show a nice error page? Of course I could do this check in the controller but at that point the traffic is already spent because the huge file has reached my server.

if (image.ContentLength > 40960) // 'image' is HttpPostedFileBase

Any suggestions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T16:18:24+00:00Added an answer on June 12, 2026 at 4:18 pm

    How about this in your global.asax.cs?

    void Application_Error(object sender, EventArgs e)
    {
        if (Request.TotalBytes > 40960 * 1024)
        {
            Server.ClearError();
            Response.Clear();
            Response.Write("File uploaded is greater than 40 MB");
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I added the following to the web.config file, but this seems to be ignored
I have added this rule in my web.config to redirect non www URLs to
I have added the following code to my web.config file: <system.diagnostics> <trace autoflush=false indentsize=4
I recently added some namespaces to my web.config file so that all of my
Ok, I downloaded the WestWind Ajax Controls, and I added this to my web.config:
in my web.config file i've added an entry: <httpModules> <add type=HDI.HTTPFilter name=HTTPFilter/> but the
I just added this to my web.xml on my JBOSS server. But it had
I added Comet servlet into Spring web application. This servlet does not differ from
This is so weird. Ok here's my connection string in the web.config of my
I have a web.config file, I need to add the SqlMembershipProvider to it for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.