I was creating a new visual webpart for MS SharePoint 2010, but since I needed to use sessions I got this error:
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.
As error message advice to you, you have to change a config file slightly. Since there is no web.config in visual webpart project, you should change the web.config on your server.
Open the web.config (the one in the folder "intepub") and then set "enableSessionState" property in "pages" tag as below:
<pages enableSessionState="true" ...
then add "remove" and "add" tags to the <system.webServer> (see? Error message advised you to add it to the system.web not to the system.webServer. And this was reason why I was struggling with this for two hours :) )
<system.webServer>
<modules>
<!-- UrlRewriter code here -->
<remove name="Session" />
<add name="Session" type="System.Web.SessionState.SessionStateModule" preCondition="integratedMode" />
</modules>
</system.webServer>
Ok then, thats all... Do not believe alerts everytime ;)
Friday, March 30, 2012
Thursday, March 29, 2012
Manage services on a server
Time to time you may need to manage services on a server. SharePoint can force you to do that by error message like this :-) “The timer job for this operation has been created, but it will fail because the administrative service for this server is not enabled. If the timer job is scheduled to run at a later time, you can run the jobs all at once using stsadm.exe -o execadmsvcjobs. To avoid this problem in the future, enable the Windows SharePoint Services administrative service, or run your operation through the STSADM.exe command line utility.“
To start Service window do this:
Start - > Run -> type services.msc -> and find service you need to manage.
In the case of error message above it would be "SharePoint 2010 Administration".
Hope it helps...
To start Service window do this:
Start - > Run -> type services.msc -> and find service you need to manage.
In the case of error message above it would be "SharePoint 2010 Administration".
Hope it helps...
Subscribe to:
Posts (Atom)