ASP.NET MVC 3: Updating controller factories to RC

With ASP.NET MVC 3 RC there is change in IControllerFactory interface. This interface includes new method called GetControllerSessionBehavior(). This method returns value from SessionStateBehavior enum. ASP.NET MVC uses this method to find out how to handle session for given controller.

If you don’t plan to do any advanced stuff with session state then the easiest way to get your controller factories work again is to add the following method to them.


public SessionStateBehavior GetControllerSessionBehavior
    (
RequestContext requestContext, string
controllerName)
{
   
return SessionStateBehavior.Default;
}

Now your controller factories should compile again.


Leave a Reply

Your email address will not be published. Required fields are marked *