2
votes

I have already research in Google about this error but couldn't succeed and finally posted here.

I have downloaded my live website, database and integrate it in my local environment. I can only see Home Page but not able to see other pages. I’m facing below error in my all other pages.

I think default.aspx is the home page in DNN so it is working fine but not other pages which are render dynamically from DNN tables.

Error Exception:

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.

Event Log Table Message:

DotNetNuke.Services.Exceptions.PageLoadException: 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. ---> System.Web.HttpException: 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. at System.Web.UI.Page.get_Session() at DotNetNuke.Framework.CachePageStatePersister.Save() at System.Web.UI.Page.SavePageStateToPersistenceMedium(Object state) at System.Web.UI.Page.SaveAllState() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) --- End of inner exception stack trace ---

I had take reference from from this link and update like below in my web config file but I missed all pages of my website and does not able to see Home Page also. EventLog table showing me same error message as I posted in my question.

Update web config like below:

<modules runAllManagedModulesForAllRequests="true">
  <remove name="Session" />
  <add name="Session" type="System.Web.SessionState.SessionStateModule"/>      

...

 <httpModules>
  <add name="Session" type="System.Web.SessionState.SessionStateModule"  />

...

<pages validateRequest="false" enableViewStateMac="true" enableEventValidation="false" viewStateEncryptionMode="Always" enableSessionState="true" >
1

1 Answers

1
votes

Before The Error:

I have added my DNN website as Sub Directory in my local IIS server so my access URL has become http://localhost/WebsiteName/. For some of the reason in DNN core libraries it doesn't work with sub directory and faced error enableSessionState is set to true, either in a configuration file or in the Page directive in my local computer but On live, It was installed as Default Web Site on IIS Server.

Error Resolved:

Just replace my website from sub directory to Default Web Site in IIS Server and it works. I didn't get any error. So, now access URL become http://localhost/

I checked both websites set in same application pool as well as same dotnet framework version but sub directory website doesn't work and when I set it to in the place of default IIS website it works.

For visitors of this post:

If you don't able to solve this error, you can go with Cathal Connoly (A DNN MVP)'s answer. Refer this link for more information.

It appears that if you change the page state persistence this will resolve it (http://www.dnnsoftware.com/Content/Dn...) , or else enable set enableSessionState to true in your web.config