Questions tagged [ihttphandler]

Defines an endpoint in the ASP.NET pipeline for processing a request.

http://msdn.microsoft.com/en-us/library/system.web.ihttphandler(v=vs.100).aspx

All requests in the ASP.NET pipeline must eventually be handled by a class implementing the IHttpHandler interface. The handler is defined in either the system level web.config and can be overridden and website and subsite levels through the configuration inheritence chain.

The handler is usually mapped to one or more extensions (.aspx, .axd, .ascx, etc) may all be handled by Page Handler.

More details and explanation of how this interacts with the ASP.NET Request/Response pipeline may be found here.

244 questions
133
votes
3 answers

Significance of bool IsReusable in http handler interface

When writing a http handler/module, there is an interface member to implement called - bool IsReusable. What is the significance of this member? If I set it to false (or true), what does this mean for the rest of the web app?
GurdeepS
  • 65,107
  • 109
  • 251
  • 387
107
votes
3 answers

What is the use for IHttpHandler.IsReusable?

I'm writing a IHttpHandler and I'll need to implement a IsReusable property. When I look at the MSDN documentation it says: Gets a value indicating whether another request can use the IHttpHandler instance. This isn't very helpful. In which…
Kees C. Bakker
  • 32,294
  • 27
  • 115
  • 203
68
votes
3 answers

How to send a Status Code 500 in ASP.Net and still write to the response?

I have an ASP.Net single-file web service (a .ashx file containing an IHttpHandler implementation) which needs to be able to return errors as responses with 500 Internal Server Error status codes. This is a relatively straightforward thing to do in…
Neil
  • 3,001
  • 2
  • 16
  • 20
68
votes
6 answers

What is an HttpHandler in ASP.NET

What is an HttpHandler in ASP.NET? Why and how is it used?
Nikola Stjelja
  • 3,659
  • 9
  • 37
  • 45
49
votes
3 answers

ASP.NET: How to access Session from handler?

i'm trying to store some values in the Session from a Handler page, before i do a redirect to a WebForms page, that will pick up the Session values and pre-fill the WebForm: public class Handler : IHttpHandler { public void…
Ian Boyd
  • 246,734
  • 253
  • 869
  • 1,219
29
votes
5 answers

Can ASP.NET Routing be used to create "clean" URLs for .ashx (IHttpHander) handlers?

I have some REST services using plain old IHttpHandlers. I'd like to generate cleaner URLs, so that I don't have the .ashx in the path. Is there a way to use ASP.NET routing to create routes that map to ashx handlers? I've seen these types of…
Samuel Meacham
  • 10,215
  • 7
  • 44
  • 50
27
votes
2 answers

Why isn't my IHttpHandler being called?

I'm trying to get a custom handler to work for a specific URL (or set of URLs) in ASP.NET 3.5. The handler doesn't actually do anything significant yet - it just logs the request. I can post the code if anyone things it's relevant, but I really…
Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194
21
votes
4 answers

Image from HttpHandler won't cache in browser

I'm serving up an image from a database using an IHttpHandler. The relevant code is here: public void ProcessRequest(HttpContext context) { context.Response.ContentType = "image/jpeg"; int imageID; if…
Jeff Putz
  • 14,504
  • 11
  • 41
  • 52
16
votes
2 answers

How do I add an HttpHandler to the web.config?

I wrote a httphandler to handle all XSLT requests. The name of the handler is XSLTHandler.cs. web.config
qinking126
  • 11,385
  • 25
  • 74
  • 124
16
votes
7 answers

IIS 7, HttpHandler and HTTP Error 500.21

On IIS 7, I'm trying to use custom HttpHandler for my ASP.NET web application. I use pipeline mode "classic", .NET version is 4.0.30319, my web.config configuration for the handler is:
Mikee
  • 626
  • 1
  • 10
  • 23
13
votes
4 answers

Update page after file download

I put together a download script after some wonderful help from stack overflow the other day. However I have now found that after the file has been downloaded I need to reload the page to get rid of the progress template on the aspx page. The code…
flyersun
  • 917
  • 3
  • 15
  • 35
13
votes
2 answers

Change ASP.NET MVC Routes dynamically

usually, when I look at a ASP.Net MVC application, the Route table gets configured at startup and is not touched ever after. I have a couple of questions on that but they are closely related to each other: Is it possible to change the route table…
flq
  • 22,247
  • 8
  • 55
  • 77
13
votes
3 answers

ASP.NET - Dynamically register an HttpHandler in code (not in web.config)

Possible Duplicate: Any way to add HttpHandler programatically in .NET? Is there a way I can dynamically register an IHttpHandler in C# code, instead of having to manually add it to the system.web/httpHandlers section in the web.config. This may…
Sunday Ironfoot
  • 12,840
  • 15
  • 75
  • 91
13
votes
3 answers

Should I set IsReusable to True in my HttpHandlers?

I've never fully understood this property of the IHttpHandler. It is a property that you have to set when you implement the interface. I've assumed that setting it to true would be better for performance, but I am not sure what the negative side…
Josh Stodola
  • 81,538
  • 47
  • 180
  • 227
13
votes
3 answers

Streaming large video files .net

I am trying to stream a large file in webforms from an HttpHandler. It doesn't seem to work because its not streaming the file. Instead its reading the file into memory then sends it back to the client. I look all over for a solution and the…
Jake
  • 1,332
  • 5
  • 23
  • 35
1
2 3
16 17