views:

72

answers:

1

I have an HttpModule that has bound an event handler to EndRequest.

Is there any way to handle the request inside the event handler? Meaning, I don't just want to run code and keep the request moving -- I want to stop it dead in its tracks, return a 200 Status Code, and call it a day, without it request continuing to the next step in the pipeline.

+2  A: 

HttpContext.Current.ApplicationInstance.CompleteRequest();

Robert C. Barth
This looks interesting, but will this kill the request entirely? I appears that ti just skips the rest of the pipeline and goes straight to EndRequest. However, that's where I'm at already (that's the event I bound my handler to), and doesn't it still to provide a response?
Deane
This will end all further processing of the request. Your handler is not the only handler in the pipeline, so this will cancel further processing of other handlers after yours and send the response immediately to the client.
Robert C. Barth