.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

how to enable session state in SPF 2010?

Posted By:      Posted Date: October 19, 2010    Points: 0   Category :SharePoint

Could someone help me on how to enable session state in SharePoint Foundation Server 2010?

Thanks in advance,


View Complete Post

More Related Resource Links

Session State throws error in ASP.NET Site Pages for SharePoint 2010 portal using Visual Studio 2010


I'm developing Visual Studio 2010 solution for site pages. I’ve created Site Pages in SharePoint 2010 and I’m trying to access Session variables in code behind in ASP.NET but it throws the following 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.

I set the page directive as enableSessionState=&quo

Enabling Session State in SharePoint 2010?


I have a web service built for SharePoint 2007 that I am trying to port to SharePoint 2010. This web service is dependent on session state to function properly, but so far, I have been enable to get session state to work at all in SharePoint 2010. This web service runs as its own web application under t he /_vti_bin virtual directory. I have tried all of the following with no luck:

  • Ensured the "State Service" service application is running.
  • Added the System.Web.SessionState.SessionStateModule http module to my application's web.config file.
  • Added the System.Web.SessionState.SessionStateModule http module to my SharePoint root web.config file.
  • Added <pages enableSessionState="true" /> to my application's web.config file.
  • Added <pages enableSessionState="true" /> to my root web.config file.
Additional Environment info:
  • Visual Studio 2008 - SP1
  • .NET 3.5 - SP1
  • SharePoint 2010 - RC
  • Windows Server 2008 R2
  • ASMX web service (not WCF)

Had anyone had any luck getting a web application or web service to use session state in SharePoint 2010 yet?



SQL Server Session state problem.


Hi to all,

I have some things that I want to know. I am right now using a free asp.net webhosting ("somee.com"). The problem is that when I am visiting a page, there's a tendency that values stored in my session variables are lost. Therefore, it causes an error when the requested page is loaded.

1. I am thinking of using sessionState mode="SqlServer". Will it solve my problem?

Actualy Im working on it but Im having problems when connecting to the sql database.

2.  Is that a problem in the webhost?

3. Do free webhosting sites provide allow session state in the sql server?. Because ive tried it locally into my computer and error say's i should intall the ASP.NET Session State SQL Server version 2.0 or above.

Best Practices: Fast, Scalable, and Secure Session State Management for Your Web Applications


ASP.NET provides a number of ways to maintain user state, the most powerful of which is session state. This article takes an in-depth look at designing and deploying high-performance, scalable, secure session solutions, and presents best practices for both existing and new ASP.NET session state features straight from the ASP.NET feature team.

Mike Volodarsky

MSDN Magazine September 2005

Taming the Stateless Beast: Managing Session State Across Servers on a Web Farm


Running a Web farm means managing session state across servers. Since session state can't be shared across a Web farm with Internet Information Services 5.0, a custom solution is required. One such solution using a tool called the session manager is described here. The article begins with a description of the SQL Server database used to store state information, the stored procedures used to update it, and the retrieval of session data. ASP code drives the session manager tool and the COM and COM+ components that run the stored procedures.

John Papa

MSDN Magazine October 2000

Session State Problem




I just for the first time into a session state problem. So I am hoping someone

here has the answer.


I have written an ASP.Net website and tried to implement the common poor mans online user count.
The problem I am having is the following.

On App_Start I create a variable and assign it the value of 0;

Then increase the number on session_start and decrement on session_end.

On my local IIS it works perfectly from IE8 and Opera. The value increments correctly.
As soon as I upload to my live server. The value increments on every link I click and every page refresh when I test with IE8.
This does not happen when testing with Opera.

Could someone please shed some light on the subject.




Louis Lews

Good news for those of you who get "Unable to make the session state request to the session state se


Dear all,

Due to the known problem of session variables getting lost if using InProc-server during frequent changes in development, I had to choose between SQL and ASP.NET State server, so I opted for the second. Initially, all fine, but after using it for a few days, I started to get this error:

 Server Error in '/cv2' Application.
Unable to make the session state request to the session state server. Please ensure that the ASP.NET State service is started and that the client and server ports are the same.  If the server is on a remote machine, please ensure that it accepts remote requests by checking the value of HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\aspnet_state\Parameters\AllowRemoteConnection.  If the server is on the local machine, and if the before mentioned registry value does not exist or is set to 0, then the state server connection string must use either 'localhost' or '' as the server name.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: Unable to make the session state request to the session state server. Please ensure that the ASP.NET State service is started and that the clie

How to use cookieless session state...

I want to know how its work and it advantage and disadvantegePls explain me with example

Session State for Listview Items?

Hi, I have a listview control, in it each item will have a checklist eg - Pass / Fail which will then have a label displaying the selected value. I also have datapager wired up to the listview. When i toggle between the datapages and toggle back, any result previously submitted will be wiped. I am thinking i should be using session state to temporarily store then info, and then once the session is finished use a submit button to send all values and ids into an xml. 1. Is this the right way of approaching the situation? 2. How would i specify session state for listview items, eg would i angle it through a itemdatabound event or the application itself?   Any assistance and advice would be appreciated as i have only started looking at state management and xml storage.  

SharePoint 2010 Publishing Site : Operation is not valid due to the current state of the object.

  I think as usual, the new version of SharePoint 2010 has a lot of problems. the below messege appear in a publushing site (FBA) enabled and when I try to access the pages list or even approve a page of accessing the SiteCollectionImages list and ......... etc every link produce the below error. I'm very frustrated with 2010.  Server Error in '/' Application. <nativehr>0x8107058a</nativehr><nativestack></nativestack>Operation is not valid due to the current state of the object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Runtime.InteropServices.COMException: <nativehr>0x8107058a</nativehr><nativestack></nativestack>Operation is not valid due to the current state of the object. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [COMException (0x8107058a): <nativehr>0x8107058a</nativehr><nativestack></nativestack>Operation is not valid due to the current state of the object.] Microsoft.SharePoint.Library.SPR

Can not enable RBS on sharepoint 2010 beta 2

I installed Sharepoint 2010 beta 2 on Windows 2008 sp2, use standalone mode, then configuration RBS according the document http://technet.microsoft.com/en-us/library/ee663474(office.14).aspx, but when I want to use Power shell enable rbs, it will throw error:PS C:\> $rbss.Installed()TruePS C:\> $rbss.Enable()Exception calling "Enable" with "0" argument(s): "SQL remote blob storage mustbe installed on each web front end server and on the content database before it may be used."At line:1 char:13+ $rbss.Enable <<<< ()    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException    + FullyQualifiedErrorId : DotNetMethodExceptionis there anybody meet the same issue with me? does anybody know how to resolve this issue? thanks very much.

Accessing Session State in a User Control

We have a web site that implements a custom SiteMapProvider using a User Control added in the master page. I need to be able to limit the sitemap nodes added depending on the logged in user, that is, certain users should not see certain sitemap nodes. Currently, the login processing code determines if users are in the certain category or role and then sets a value in session state, for example, Session["UserInRoleXXX"] = "Yes"; I tried changing the code in the user control to check the session state, but I got the following error: NullReferenceException ... Object reference not set to an instance of an object." Can session state be accessed in a user control? If so, how? If not, any suggested solutions? Thanks in advance for any help.

How to enable Search on SharePoint 2010 FBA site?

Hello Friends, I have configured Forms Based Authentication (FBA) on SharePoint Server 2010. Can anyone explain how to implement/enable enterprise search on this FBA site. I want to provide search features on this FBA site like in Windows Authentication sites. Thanks...Regards, Gautam Kaikini, SharePoint Developer, MCP, MCTS WSS 3.0 Application Development.

Session state and MVC

I'm trying to maintain session state for a user with MVC.  What is the best approach?


I created a page which runs a THREAD.  Unfortunately, at the end of the THREAD which is designed to populate a table, an error is produced.  It says that the SESSION STATE CAN ONLY BE USED WHEN ENABLESESSIONSTATE IS SET TO TRUE.  I added the ENABLESESSIONSTATE to my page directive.  However, it seems that this does not suffice.  It also says the I need to add a CUSTOM SESSION STATE module in the CONFIGURATION section.  Is there an example of where I do this in the WEB.CONFIG.  I need a fairly detailed WEB.CONFIG as I don't want to break what I have at the moment. TIAJohn

What are the benefits of using ASP.NET Session State in a Web Service

I have a question regarding session state usage in a  Web Service method. I thought about this situation as I came across an article http://msdn.microsoft.com/en-us/library/aa480509.aspx Situation is that A. There are web service methods which are being exposed. One web method to store value in a session state and another to get value from session state. B. There is another asp.net website which calls the above web methods.        B                    ----------------------------------->       A (Another ASP.NET Website)                 (WebService hosted in an ASP.NET website)   Questions: Does webmethod can store data in a session variable in Webservice application's IIS (in Proc)? I tried this (refer below code snippets) but I was not able to store and get data thru webmethods into/from state. Why?? What is the use of storing it in the state of the Webservice's website IIS (in proc). Will there be any session objects create due to any web service calls from clients? What are the benefits of saving a value in WebService's session, not in the calling website's session. A WebService's webmethod can able to use session state, does that mean that a session will b
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend