When IIS is not configured properly after creating SharePoint application and there are web parts or features that use session you may get the following error: Unexpected error occured: 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.
Solution
As a solution you must register session state handler module in IIS.
- Open Internet Information Services manager.
- Move to site where problem occurred.
- Open modules list of this site.
- Add session state handler like show on the following image (click on it):
- Click OK, recycle application pool and refresh the page.
I am not very sure why SharePoint doesn’t enable this module by default as mostly default session state module is enough.
View Comments (4)
Please GEEKS!,
Would you think somebody posted this question might have even checked this funda?
To all sufferers of this problem, I have my findings here!
1. I could reproduce this issue in IE browser(IE10) and FIREFOX(22), though I have great settings of all enabled..etc.etc... in my local code, WHEN IE settings in Connection Tab --> LAN settings have "Use PROXY Server for Localhost..." checkbox shown as CHECKED - without a VALID PROXY server setting...
When I uncheck this In IE, the same code with DEFAULT Session settings, runs like HORSE!!
Doom to all GEEKS OUT THERE...
But for common people, IT WAS GIVING NIGHTMARES TO ME, hope I could save a few out of yours!
Peace!
Thank you a lot!
Could be your skype intercepting your requests at 80 port, in Skype options uncheck
Or Your IE has connection checked for Proxy when there is no proxy
Or your fiddler could intercept and act as proxy, uncheck it!
Solves the above problem, It solved mine!
HydTechie
Thanks Bro very useful article. it saves alot of my time and efforts.
Thank you so much!