Note : Cet article a été publié à l’origine en 2010. Certaines étapes, commandes ou versions de logiciels ont pu changer. Consultez la documentation actuelle de .Net pour les informations les plus récentes.
Prérequis
Avant de commencer, assurez-vous d’avoir :
- Visual Studio or .NET CLI installed
- .NET Framework or .NET Core SDK
- Basic C# programming knowledge
How to enable Session State in SharePoint 2010
So as a developer you may have come across the need to use the Session object along the way. What you’ve probably noticed is that you get an error message that indicates you should enable session state as well as configure your http session module for sessions:
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 web.config
In order to resolve this you should make two entries into your web.config (in this case the one located under: C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions14TEMPLATELAYOUTS) file and run an SP command:
The first is to ensure that enableSessionState is set to TRUE.
if you don’t have the pages directive you can add it the following one under the
This is found under the
The second is to ensure that you have enabled Session as an http module by addint the following lines under the
The third step is to run the following SP command line:
Enable-SPSessionStateService –DefaultProvision
This instruction needs to be executed in the SP 2010 Power shell otherwise it won’t work. Be sure to run the power-shell as an administrator otherwise it won’t work.
For more information please visit the references below
Références:
Résumé
Articles Connexes
- How to: turn off custom errors for debugging mode in SharePoint 2010 application pages
- How to make your Telerik controls work on a Custom SharePoint 2010 web application
- Telerik - The base class includes the field {}, but its type {} (Telerik.Web.UI.RadGrid) is not compatible with the type of control (Telerik.Web.UI.RadGrid).
- Entity Framework 4: Any way to know the plural form of an Entity Type?