Session state can only be used when enableSessionState is set to true error ?
Hi allI have acustom aspx page that uses session variables in the codeIt works fine on the development machinebut when uploaded on the production server when I navigate tot the page it gives the following error 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 <configuration>\<system.web>\<httpModules> section in the application configuration. I enabled session state from the web config by adding the http module<add name="Session" type="System.Web.SessionState.SessionStateModule"/>and setting enableSessionState attribute of the <pages> element to trueso what can be the reason for this.note: the production server is windows server 2008 r2there is no sql server installed on the production server, could that be the reason ?thanksMina ------------- http://www.learn-mvc.blogspot.com/
January 21st, 2010 6:52am

ok I got itjust add this to web.config under safe controls section <PageParserPaths> <!-- To allow global: --> <PageParserPath VirtualPath="/*" CompilationMode="Always" AllowServerSideScript="true" IncludeSubFolders="true" /> </PageParserPaths>thanksMina ------------- http://www.learn-mvc.blogspot.com/
Free Windows Admin Tool Kit Click here and download it now
January 21st, 2010 8:00am

Where would the safe controls section be?
February 1st, 2011 10:46am

Hi, I have fixed this issue and made a post to share my solution. Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. In the end of the post,I gave a sample config. <?xml version="1.0"?> <configuration> <system.web> <sessionState mode="InProc" timeout="60" cookieless="false" ></sessionState> <httpModules> <add name="Session" type="System.Web.SessionState.SessionStateModule" /> </httpModules> <pages enableSessionState="true" enableViewStateMac="true" enableEventValidation="true" clientIDMode="AutoID"> </system.web> </configuration> Frank Xu Lei-- .NET Focus on Distributed Applications Development and EAI based on .NET http://www.frankxulei.com/ WCF WCF Windows Azure
Free Windows Admin Tool Kit Click here and download it now
May 2nd, 2011 2:28am

Hey Frank, I am facing Similar Issue. Could you please provide an alternative link for your solution as I am unable to reach your solution? its showing as the site is temporarily down. Thanks,K.V.N.PAVAN
May 14th, 2012 8:51am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics