2

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!

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.