Gunnar Peipman's ASP.NET blog

ASP.NET, C#, SharePoint, SQL Server and general software development topics.

Sponsors

News

 
 
 
DZone MVB

Links

Social

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.

Posted: Nov 23 2010, 03:25 AM by DigiMortal | with 3 comment(s)
Filed under: ,

Comments

Twitter Trackbacks for ASP.NET MVC 3: Updating controller factories to RC - Gunnar Peipman's ASP.NET blog [asp.net] on Topsy.com said:

Pingback from  Twitter Trackbacks for                 ASP.NET MVC 3: Updating controller factories to RC - Gunnar Peipman's ASP.NET blog         [asp.net]        on Topsy.com

# November 22, 2010 9:19 PM

Gee said:

Do you even need to have a controller factory any more? I am using structuremap and only implement the IDependencyResolver interface - MVC 3 uses this internally and the controller resolution is handled automatically.

Do you have some custom behaviour inside your controller factory that you wouldn't get if you just implemented the generic dependency resolver?

# November 23, 2010 4:29 AM

Slava Agafonov said:

good advice, thanks.

# November 23, 2010 7:27 AM