I tried to URLRewrite module to redirect, rewrite and abort requests to site. But site shown error.
I wrote down IHttpModule
which does similar, and calls HttpApplication.Context.Response.End();
in 'HttpApplication.BeginRequest'.
This leads to direct jump into EndRequest
event. Site does not expect this and throws InvalidOperationException in its EndRequest
indicating that trying to clean some database code even without initialization. The same with URLRewrite
.
I think this is because End()
call skips initialization.
How to prevent this error to be shown to user? Kind of swallow it without ability to modify 3rd party site.
I experimenting with other HttpApplication
events and do not want request to be handled, i.e. nothing written down to database as part of request. Not results here yet, what other options?