httpexception

Why do I get "Cannot redirect after HTTP headers have been sent" when I call Response.Redirect(url)?

When I call Response.Redirect(someUrl) I get an HttpException: "Cannot redirect after HTTP headers have been sent". ...

Diagnosing "Request timed out" HttpExceptions

Here on StackOverflow, we're seeing a few "Request timed out" exceptions every day. The facts: Request timeout is the default 90 seconds Occurs only on POSTs Data posted is text, usually small (< 1KB), but can range to a few KB No Form data is captured in server variables Client UAs are diverse: IE5.5 - 7, Firefox 3.0.5, iPhone, Chrom...

How do you test error handling involving "remote host" errors with ASP.NET development server?

We have an ASP.NET website in production that generates a report and sends it to the user's browser as a PDF file. Our error reporting is showing that we are getting a lot of this exception: System.Web.HttpException: The remote host closed the connection. The error code is 0x80072746. These appear to be caused by the user closing thei...

Catching "Maximum request length exceeded"

I'm writing an upload function, and have problems catching "System.Web.HttpException: Maximum request length exceeded" with files larger than the specified max size in httpRuntimein web.config (max size set to 5120). I'm using a simpled <input> for the file. The problem is that the exception is thrown before the upload button's click-ev...

Render view to string followed by redirect results in exception

So here's the issue: I'm building e-mails to be sent by my application by rendering full view pages to strings and sending them. This works without any problem so long as I'm not redirecting to another URL on the site afterwards. Whenever I try, I get "System.Web.HttpException: Cannot redirect after HTTP headers have been sent." I belie...

Rendering a view to a string in MVC, then redirecting -- workarounds?

Hi -- I can't render a view to a string and then redirect, despite this answer from Feb (after version 1.0, I think) that claims it's possible. I thought I was doing something wrong, and then I read this answer from Haack in July that claims it's not possible. If somebody has it working and can help me get it working, that's great (and...

"Unable to validate data" HttpException from my .net 2.0 application

I am getting this exception from my ASP .net application running in a webfarm. Exception Type: System.Web.HttpException Exception Message: Unable to validate data. ---- Stack Trace ---- System.Web.Configuration.MachineKeySection.GetDecodedData(buf As Byte[], modifier As Byte[], start As Int32, length As Int32, dataLength As Int32&) ...

Respone.Redirect causes error once in a while, but i can't reproduce it

Hi, I have a website that will log the user out after a while of inactivity. This is done by the following code: window.location = "./logout.aspx?timeout=true"; But three times in the last couple of days I have received the following exception: System.Web.HttpException The file '/NIR310/Person/logout.aspx' does not exist. at S...

BinaryWrite exception "OutputStream is not available when a custom TextWriter is used" in MVC 2 ASP.NET 4

Hi, I have a view rendering a stream using the response BinaryWrite method. This all worked fine under ASP.NET 4 using the Beta 2 but throws this exception in the RC release: "HttpException" , "OutputStream is not available when a custom TextWriter is used." <%@ Page Title="" Language="C#" Inherits="System.Web.Mvc.ViewPa...

How to diagnose "the operation has timed out" HttpException

I am calling 5 external servers to retrieve XML-based data for each request for a particular webpage on my IIS 6 server. Present volume is between 3-5 incoming requests per second, meaning 15-20 outgoing requests per second. 99% of the outgoing requests from my server (the client) to the external servers (the server) work OK but about 1...

Not getting redirection to custom error page using custom errors - ASP.Net

Here's my Application_OnError event sink in global.asax.vb: Sub Application_OnError(ByVal sender As Object, ByVal e As EventArgs) Dim innerMostException As Exception = getInnerMostException(Me.Context.Error) If TypeOf innerMostException Is AccessDeniedException Then Security.LogAccessDeniedOccurrence(DirectCast(in...

Server.Transfer("error_404.aspx") in Application_Error returns a blank page

I look for HttpExceptions in the Application_Error sub of my global.asx Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) Dim ex As Exception = HttpContext.Current.Server.GetLastError() If ex IsNot Nothing Then If TypeOf (ex) Is HttpUnhandledException Then If ex.InnerExcept...

Stop exception from being thrown for non-existant controller

Ok, so I am stumped on this issue. I have seen a lot of things that are supposed to resolve this issue, but I am not getting a resolution that can fulfill my requirements. I am using ELMAH to log exceptions and am getting this exception when either a URL with invalid controller or proper controller and invalid action. System.Web.HttpEx...

DebugDiag configuration for catching specific HttpException.

Hi, Does anyone have any experience with setting up DebugDiag to trigger on a specific HttpException? The advanced configuration only allows you to specify the .NET type of the exception, while HttpExceptions are very generic and are used for anything from 404's to timeouts. I'm interested in triggering a dump on page timeout in this ca...

"Request is not available in this context" on Nested User Control

I have three objects: A Page which contains A User Control (A) which contains Another User Control (B) The scenario is an event in User Control A gets called, the Request object is still accessible here. But during that call, I attempt to call Request again through User Control B, User Control A's child class, and it starts throwing ...

ASP.Net debug directory monitoring exception

When I start my ASP.Net 4.0 web app in debug mode, I'm getting the following exception: System.Web.HttpException occurred Message=Invalid file name for file monitoring: 'C:\src\main-232\src\ZNode\Znode_MultiFront\Web\Controls\Cat5\Navigation'. Common reasons for failure include: - The filename is not a valid Win32 file name. - The fil...