ASP.NET Session State Error only on default document
I have a site where when accessing via site.com/default.aspx everything is fine, however when accessing via site.com/ I get a session error as follows:
"Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. Please also make sure that System.Web.SessionStateModule or a custom session state module is included in the \\ section in the application configuration."
I have confirmed that default.aspx is the highest priority default document and that it is the page being loaded. However why is this session e开发者_如何学编程rror only occurring when accessing via the default document?
The server is 2008 R2 and IIS 7.5.
Answering my own question here. Another symptom was that Page.User was always null. I found a post on SO about something similar
UrlRewriting.Net Module + IIS7 Equals Page.User == null?
and while we are not using the urlrewriting module, adding the
runAllManagedModulesForAllRequests="true"
to the modules section in the web.config. Hope this can help someone else some day!
精彩评论