Error calling MvcHttpHandler.ExecuteRequest from user IHttpHandler

I have a custom IHttpHandler that calls MvcHttpHandler implemented as described in this answer .

It worked well in asp.net MVC2, but after porting the code to MVC4 using IISExpress 7.5, I started getting an InvalidOperationException in the line:

httpHandler.ProcessRequest(HttpContext.Current); 

with the message:

'HttpContext.SetSessionStateBehavior' can only be raised by the HttpApplication.AcquireRequestState event.

ASP.NET Development Server does not pose any problems.

Does anyone know what is going on here and how to solve it?

+7
source share
1 answer

I believe you need to use httpContext.Server.TransferRequest with MVC update.

See this question: MVC3 Application Inside Web Applications Application Routing throws HttpContext.SetSessionStateBehavior error in IIS7.5

+7
source

All Articles