0

I'm using session state variables in my webpart on SharePoint Foundation 2010. It works fine until a user accesses the web application using the FQDN.

http://myapp = works fine
http://myapp.company.com = error

It gives Session State errors. When I try to edit the page and add the webpart in the myapp.company.com it gives me the below error, but the /myapp page works properly.

Session State Error

I've made the changes to the web.config on every server on the farm and session state DOES work so long as the FQDN is not used.

FQDN error:

Error: Unexpected 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>

  • did you enable the session state in the IIS as well for the web app? – Waqas Sarwar MVP Jun 16 '14 at 21:58
1

When IIS is not configured properly after creating SharePoint application and there are web parts or features that use session you may get same error as you mentioned.

Solution As a solution you must register session state handler module in IIS.

  1. Open Internet Information Services manager.
  2. Move to site where problem occurred.
  3. Open modules list of this site.
  4. Add session state handler like show on the following image (click on it): enter image description here
  5. 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.