I have a site collection which contains some web parts. After upgrading the relevant content database from SharePoint 2010 to SharePoint 2013, I rebuilt the web parts on SharePoint 2013 through Visual Studio 2012 (.Net Framework 4.5), and deployed them to that site collection.
However, the error below popped up.
"Sorry, something went wrong
An unexpected error has occurred.
Web Parts Maintenance Page: If you have permission, you can use this page to temporarily close Web Parts or remove personal settings. For more information, contact your site administrator.
Troubleshoot issues with Microsoft SharePoint Foundation.
Correlation ID: 8a80079c-c732-3006-daf1-b07efcef7326
Date and Time: 14/03/2013 9:25:53 AM"
This doesn't tell us anything, but in SharePoint 2013 log file, I got more details:
"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
\ \ section in the application configuration.
This is weird, because I can see the "Session State Service" is running from Central Admin site.
However, in the Web Application web.config file, the "Session" module is not there.
Then, I checked the Session State Service status through PowerShell script Get-SPSessionStateService
So, in SharePoint 2013, the "Session State Service" is disabled by default!
To resolve this problem is easy, run PowerShell script: Enable-SPSessionStateService –DefaultProvision
And now, if we check the web.config file, the "Session" module is added there.
<add name="Session" type="System.Web.SessionState.SessionStateModule" />
As a quick fix, we can run the PowerShell scripts below to reset "Session State Service"
Enable-SpSessionStateService -DatabaseName SP_SessionState