473,938 Members | 4,225 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Unhandled Exceptions and Maximum request length exceeded

I have an HttpModule used for Unhandled Exception processing. The module
monitors both
application.Err or += new EventHandler(On Error); //regular UHE
AppDomain.Curre ntDomain.Unhand ledException += new
UnhandledExcept ionEventHandler (OnUhe); //UHE on threads
If I do a throw, the first one gets it.
If I do a throw in a thread, the second one gets it.

In each case I process the exception as follows:
HttpContext.Cur rent.Response.C lear();
HttpContext.Cur rent.Response.C learContent();
HttpContext.Cur rent.Response.W rite( a web page with pretty message);
HttpContext.Cur rent.Response.F lush();
HttpContext.Cur rent.Server.Cle arError();
HttpContext.Cur rent.Response.E nd();

This works fine for theads and throws.

When I was testing a file upload control and trying to upload a file greater
than
<httpRuntime maxRequestLengt h="4096" />
Both events fire and I get a generic web page that says:
"The connection to the server was reset while the page was loading."

How come I get both events and how come my pretty error page is not
displayed? I put in break points and the page creation stuff does get hit.
Actually the page creation code gets hit twice.

thanks,

Oct 31 '07 #1
1 3465
in http there is no way to tell the browser to stop sending the request
other than closing the connection. as the browser could not complete the
request, it does not bother reading the response.

-- bruce (sqlwork.com)

Chuck P wrote:
I have an HttpModule used for Unhandled Exception processing. The module
monitors both
application.Err or += new EventHandler(On Error); //regular UHE
AppDomain.Curre ntDomain.Unhand ledException += new
UnhandledExcept ionEventHandler (OnUhe); //UHE on threads
If I do a throw, the first one gets it.
If I do a throw in a thread, the second one gets it.

In each case I process the exception as follows:
HttpContext.Cur rent.Response.C lear();
HttpContext.Cur rent.Response.C learContent();
HttpContext.Cur rent.Response.W rite( a web page with pretty message);
HttpContext.Cur rent.Response.F lush();
HttpContext.Cur rent.Server.Cle arError();
HttpContext.Cur rent.Response.E nd();

This works fine for theads and throws.

When I was testing a file upload control and trying to upload a file greater
than
<httpRuntime maxRequestLengt h="4096" />
Both events fire and I get a generic web page that says:
"The connection to the server was reset while the page was loading."

How come I get both events and how come my pretty error page is not
displayed? I put in break points and the page creation stuff does get hit.
Actually the page creation code gets hit twice.

thanks,
Nov 1 '07 #2

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

Similar topics

2
2695
by: Jacky Kwok | last post by:
Dear all: I know how to use the "Application_Error" in "Global.asax" to catch the exception and display my own error message page. However, I found "Application_Error" cannot handle the error of "Maximum request length exceeded" (in my case, actually too large upload file size, I know how to modify the "maxRequestLength" to change the upload size but I need a formal error message in this case).
11
5580
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 the "Maximum request length exceeded" HttpException when a user tries to send a file that is greater than 2MB so that I may tell the user, gracefully, that their file is too big.
0
1658
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 storing them as Application level variables (naming them with the SessionID)? Just curious... Thanks, Chris
3
4001
by: Hema S via DotNetMonster.com | last post by:
Hi All, My requirement is like I should not use pagination in datagrid... and some times the data exceed over 1000 and my file size if i save it as html becomes more than 7 MB and when i try do any operation in my page i get Max Request Length Exceeded.
5
3327
by: Samuel R. Neff | last post by:
When you have an unhandled exception in vb.net how do you view the exception information in the debugger? In C# the debugger creates a local variable that points to the exception and you can view it in one of the windows (autos or locals, don't remember which). That doesn't appear to be the case with vb.net. I also tried using the command window to inspect "Err" but that gave nothing useful (always empty).
0
2000
by: Colmeister | last post by:
I recently read Jason Clark's excellent article on Unhandled Exceptions (http://msdn.microsoft.com/msdnmag/issues/04/06/NET/default.aspx) and have attempted to incorporate the features he talks about in a new application I'm writing. However, when I try to use ThreadStart to do some work in a separate thread from my GUI, the methods Jason described don't seem to catch the exception. Take the following source code: Public Class...
3
4944
by: J055 | last post by:
Hi How do I tell the user he has tried to upload a file which is too big... 1. when the httpRuntime.maxRequestLength has been exceeded and 2. when the uploaded file is under then httpRuntime.maxRequestLength For point 1. it would be good to at least display a nice error page. IE seems to just display a blank page.
11
5963
by: =?Utf-8?B?VmxhZCBIcnlib2s=?= | last post by:
Using IIS7, Vista x64, ASP.NET 2.0. I am getting HTTP 400 "Bad Request" for the following URL: /HTTPVPNWebPortal/62ccc22e-069b-441e-b9f0-83b45e7f4f1e/UdVpnSGFuZGxlcnMvQ292ZXJBcnQuYXNoeD9DJTNhJTVjRG9jdW1lbnRzK2FuZCtTZXR0aW5ncyU1Y011c2hyb29tJTVjTXkrRG9jdW1lbnRzJTVjTXkrTXVzaWMlNWNGcmVuY2glNWNBbWVpbGUlNWNZYW5uK1RpZXJzZW4rLStMYStOb3llZS5tcDM=/SecureTunnel.axd Here's what makes difference: - URL length: As soon as I make this URL two chars...
1
2267
by: Cactus77 | last post by:
Hi, I have a problem with deploying a Report Model. I've build a Report Model in Visual Studio and by deploying mij my model, I get the next error: System.Web.Services.Protocols.SoapException: There was an exception running the extensions specified in the config file. --- System.Web.HttpRequest.GetEntireRawContent() at
0
9963
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11288
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
8218
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7381
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6075
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6295
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4904
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3501
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.