Archive for November, 2011
If you’re trying to use the Page Session to store some values for your application pages, and you come across an error like:
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
Don’t go crazy modifying your web.configs manually. Imagine the chaos you would start in your farm if you have multiple WFE’s and made a little mistake. I still remember the episode, somewhere back in 2007 when I started playing with MOSS, that some manual change to one WFE’s web.config caused the whole farm to collapse a couple of days later. The misconfiguration kept being logged to the DB, until it consumed all the resources and killed the farm. Yikes!
Sidetrackings aside, stepping out from memory lane, and back to the main topic of this post. Here is the one liner you need to execute on your SharePoint Management Shell to solve your problem:
Enable-SPSessionStateService -DefaultProvision
Hope it helps!
For self-reference, here goes:
If you’ve defined
CustomError = “Off”, Debug=”true” and Callstack=”True”
in <inetpub>\wwwroot\wss\VirtualDirectories\<Port Number of your App>\web.config
and you still get no details about your error, then you might want to check both 14 hive web.config files at
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS
and
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\ADMIN
Also there, you need to set CustomErrors=”Off” and you will finally start seeing some error details on your page.