I lost several hours on a problem that what solved by something very simple but unexplainable from my side. I had to create a new MasterPage for our MySites. On the root site collection of the MySites WebApplication we published some custom application pages to extend the standard functionality. These pages used the session state (HTTPContext.Current.Session) to store their model. Everything worked fine with the old MasterPage, but as soon as I selected the new one, the Edit Profile page started complaining that the SessionState was empty. I checked lots of things, even copied the old MasterPage sourcecode into the new MasterPage which didn’t worked neither. After lots of google links, a lot of frustration, even opening IIS, web.config files, trust configs, etc I found the solution on an other blog (lucky for me I’m not alone). Because it took me quite some links to read, I repost the solution here.
- If you get a HttpContext.Current.Session is nothing or HttpContext.Current.Session is null.
- If a page gives you “Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive” and you’re absolutely sure you did this and other things Microsoft recommends to use Session State in SharePoint.
- If you have enabled Session State through SharePoint Central Administration.
- When you try to set the EnableSessionState attribute on the Page directive of your Application Page and the following error comes back: “The enablesessionstate attribute on the page directive is not allowed in this page.”.
Then just use the ‘Reset to site definition‘ in your Site Settings of your Site Collection. Simple isn’t? What is it doing, well send an email to Microsoft, because I can’t tell you, but it fixed the problem for me.
June 8, 2010 at 14:27
Hi,
I am facing the same issue, I want to change master page of my pwas site.
Once I change master page I am not able to see the page and getting below error message.
“The enablesessionstate attribute on the page directive is not allowed in this page”
Can you please help?
I have also posted this question to one of the forum site. You can also reply to that forum site so that others can also view.
http://stackoverflow.com/questions/2997457/how-to-modify-default-master-page-in-microsoft-project-server-2007
Thanks
June 9, 2010 at 8:41
Is session state enabled through Central Administration and did you try the Reset to site definition option?
June 9, 2010 at 15:00
Thanks for quick reply.
From where in Central Administration? Can you please explain me the steps?
Also I tried to do Reset to site definition from Site Setting -> Look and Feel -> Reset to site definition.
But my question here which url I have to mention because I am modifing default.master. And what exactly it will do? If it will reset master page then my changes will revert back. My objective is to modify default.master page.
June 10, 2010 at 7:33
Just go to Central Administration, tab Application Management. Under Office SharePoint Server Shared Services you can find an option Configure session state. Make sure Enable Session State has been marked.
If you changed the default.master it will revert your changes off course. It’s always better to copy the default master to a new master file and change that file. This way you can always use the option ‘Reset to Site defintion’.
June 17, 2010 at 6:57
Still I guess you did not understood my problem. I want to modify default.master page. Reset to site definition is something that I will do to revert back my changes. I dont want to revert back my changes my objective is to change default.master page.
September 23, 2010 at 15:34
Having exact same issue – Reset to site definition fixes the problem in dev, but its not an option for production so opening a ticket with MS to get some answers…
Did find out why it was happening?
March 18, 2011 at 14:48
Found it: just set the enableSessionState to “true” manually in the application web.config.