Any ideas how to fix the below?
There is a great implementation of TransferResult available here, which worked great on MVC 1,2 but doesn't work on MVC 3 RC.
public class TransferResult : RedirectResult
{
public TransferResult(string url): base(url)
{
}
public override void ExecuteResult(ControllerContext context)
{
var httpContext = HttpContext.Current;
httpContext.RewritePath(Url, false);
IHttpHandler httpHandler = new MvcHttpHandler();
httpHandler.ProcessRequest(HttpContext.Current);
}
}
On MVC 3 RC, httpHandler.ProcessRequest fails and says 'HttpContext.SetSessionStateBehavior' can only be invoked before 'HttpApplication.AcquireRequestState' event is raised.
How to rewrite this code to make this work?
UPD: The code works if run on VS 2010 built-in development server, but fails to run on IIS 7.5 localhost. The problem is still unresolved.
UPD2 This answer contains a modified implementation of TransferResult which works with MVC3. Turns out it is even simpler than it used to be.