Questions tagged [httpexception]

HttpException or HTTPException are exception classes defined by various object oriented libraries that signal a problem during processing of a http request.

There is a HttpException in the System.Web namespace of .Net, another one in Apache Commons and a HTTPException in JAX-WS

160 questions
113
votes
16 answers

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 simple for…
Marcus L
  • 4,030
  • 6
  • 34
  • 42
112
votes
8 answers

How do I get StatusCode from HttpRequestException?

I'm probably missing something obvious here. I'm using HttpClient which throws HttpRequestException that contains StatusCode in the Message string. How can I access that StatusCode? Edit: More info, I wrote this question in rush. I'm using…
Kugel
  • 19,354
  • 16
  • 71
  • 103
90
votes
15 answers

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

When I call Response.Redirect(someUrl) I get the following HttpException: Cannot redirect after HTTP headers have been sent. Why do I get this? And how can I fix this issue?
Samuel Meacham
  • 10,215
  • 7
  • 44
  • 50
83
votes
7 answers

ASP.NET Core equivalent of ASP.NET MVC 5's HttpException

In ASP.NET MVC 5 you could throw a HttpException with a HTTP code and this would set the response like so: throw new HttpException((int)HttpStatusCode.BadRequest, "Bad Request."); HttpException does not exist in ASP.NET Core. What is the equivalent…
Muhammad Rehan Saeed
  • 35,627
  • 39
  • 202
  • 311
27
votes
7 answers

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…
Jarrod Dixon
  • 15,727
  • 9
  • 60
  • 72
24
votes
8 answers

The handle is invalid. (Exception from HRESULT: 0x80070006 (E_HANDLE))

I have a website in an IIS 7 shared hosting environment. It's running .NET 3.5. I have a download button to download a file from the server. When I locally deploy this application to IIS 6, it runs fine. On the IIS 7 shared hosting server, the…
Salman Roy
  • 575
  • 2
  • 12
  • 27
20
votes
7 answers

HttpContext throws HttpException

I have written a custom http handler. I have done this by writing a class which implements the IHttphandler. Inside that class I have code like…
peter
  • 13,009
  • 22
  • 82
  • 142
19
votes
13 answers

Flutter occurs 'Error connecting to the service protocol: HttpException...' error on iOS device

For network connection I use dio and for checking connection state from Connectivity. And in here I check network state: @override Widget build(BuildContext context) { bloc.checkConnectivity(Connectivity()); return StreamBuilder( stream:…
Saeid
  • 2,261
  • 4
  • 27
  • 59
17
votes
3 answers

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

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…
Grant
  • 171
  • 1
  • 1
  • 3
15
votes
4 answers

Flutter: Connection closed while receiving data

I'm calling post API, and sometimes I get the response from the server and sometimes I receive the exception Connection closed while receiving data. Request is same in both cases, and according to backend server logs, a response is sent but i didn't…
Nabeel Ashfaq
  • 153
  • 1
  • 1
  • 4
15
votes
3 answers

Throwing an HttpException always sends back HTTP 500 error?

I'm trying to throw an HTTP 403 error code back at the client. I've read that HttpException is the cleanest way to accomplish this, but it's not working for me. I throw the exception from within a page like this: throw new HttpException(403,"You…
Earlz
  • 62,085
  • 98
  • 303
  • 499
11
votes
3 answers

ASP.Net debug directory monitoring HttpException

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'.…
Brad Urani
  • 1,429
  • 1
  • 16
  • 29
10
votes
3 answers

HTTPException: invalid and/or missing SSL certificate for url: https://accounts.google.com/o/oauth2/token

When I call for the Google Earth Engine (GEE) Python APIs through Google AppEngine, it throws out a HTTPException which says "HTTPException: invalid and/or missing SSL certificate for url: https://accounts.google.com/o/oauth2/token". The project…
10
votes
4 answers

Stop exception from being thrown for non-existent 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…
Dustin Laine
  • 37,935
  • 10
  • 86
  • 125
9
votes
1 answer

How to troubleshoot "System.Web.HttpException (0x80004005): File does not exist"?

Apologies if this has already been answered on this site, I searched but did not find this exact scenario. I'm adding log4net to a WCF service. I added a handler in the Application_Error event, and it is catching a file not found error on every…
camainc
  • 3,750
  • 7
  • 35
  • 46
1
2 3
10 11