views:

33

answers:

1

If I create an ASP.NET Web Application project and then add an ASP.NET MVC 2 to it using the default routes defined like so

        routes.MapRoute(
            "Default", // Route name
            "{controller}/{action}/{id}", // URL with parameters
            new { action = "Index", id = UrlParameter.Optional }
        );

The Session object is NULL when I try and access it in the action methods of the controllers. If I change my routes to this.

        routes.MapRoute(
            "Default", // Route name
            "{controller}.aspx/{action}/{id}", // URL with parameters
            new { action = "Index", id = UrlParameter.Optional }
        );

Everything works just fine. For whatever reason having the .aspx extension allows for session to be used, but the later doesn't. I'm using .NET 3.5 for everything.

Any ideas??? Thanks!

A: 

The solution is to add runAllManagedModulesForAllRequests="true" to the configuration>system.webServer>modules tag in the web.config.

Randall Sutton