XAP.NET 7.0.X Documentation > Back to Table of Contents
GigaSpaces .NET Session State Store Provider
Summary: How to use the .Net GigaSpaces Session State Store Provider implementation.
OverviewThe session state store provider is used by the IIS (Internet Information Services) to supply a data store for active sessions. This implementation uses GigaSpaces as the session data storage provider.
Using the session-state store provider, values that need to be persisted during a user session are stored into session variables. These variables are unique in each user session. You can set and access session information from within an ASP .NET application. For example: //Assign a value to the buttonCount session variable: Session["buttonCount"] = 0; InstallationTo use this practice, compile the reference: <GigaSpaces Root>\Bin\GigaSpaces.Practices.HttpSessionProvider.dll through Visual Studio, using the solution located at <GigaSpaces Root>\Practices\HttpSessionProvider\GigaSpaces.Practices.HttpSessionProvider.sln. ConfigurationSession state implementations can be configured by setting the mode attribute to a valid SessionStateMode sessionState element in your application configuration.
The mode attribute is set up in the web.config file (or the machine.config file). The machine.config file is located in c:\\Microsoft.NET\Framework\\config\machine.config. <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"> <connectionStrings> <!--This specifies the connection string to connect to the space--> <add name="SpaceSessionProviderURL" connectionString="--Connection String Url to the GigaSpaces session state storage provider (you can use "jini://*/*/mySpace" for remote space)--" /> </connectionStrings> <system.web> <sessionState mode="Custom" customProvider="GigaSpaceSessionProvider" cookieless="true" timeout="5" regenerateExpiredSessionId="true"> <providers> <!-- the name type and connectionStringName should be set as follows, writeExceptionToEventLog states weather unexpected exception should be written to a log or thrown back to the client. supportSessionOnEndEvents states weather the provider should support triggering Session_End events when sessions expires.--> <add name="GigaSpaceSessionProvider" type="GigaSpaces.Practices.HttpSessionProvider.GigaSpaceSessionProvider" connectionStringName="SpaceSessionProviderURL" writeExceptionsToEventLog="--true/false--" supportSessionOnEndEvents="--true/false--" /> </providers> </sessionState> </system.web> </configuration> To use a custom provider, mode must be set to Custom, and the providers element must also be used.
ExceptionsWhen enabled, the writeExceptionToEventLog parameter instructs exceptions thrown by the provider to be written in detail to the Event Log (only a general exception is thrown to the client). Otherwise, the exceptions are thrown only to the client. Expired SessionsThe supportExpiredSessions parameter, when enabled, instructs the provider to trigger Session_End events when a session expires.
DeploymentThe type of deployment depends on if the load-balancer is configured to work with sticky sessions, or not (session stick at the same server once created). If the load-balancer is configured to work with sticky sessions, a recommended deployment pattern is the master-local topology, where each server has a local cache that is connected to a remote master cluster or space topology. If this is not the case, master-local is not recommended since it creates larger overhead when sessions are transferred between the servers. Reducing Network LoadIt is possible to reduce the network load by splitting the SessionDataEntry object (the object that holds the session information in the space) in the implementation into two classes; where one class holds the session item's data, and the other class holds the inner variables such as locked state, locked date, etc. This way, each session includes two objects that represent it in the space. Using such a data model might complicate the space interaction a bit, since managing the dependencies between the objects and synchronizing the lease expiration requires some more coding. |
![]() |
GigaSpaces.com - Legal Notice - 3rd Party Licenses - Site Map - API Docs - Forum - Downloads - Blog - White Papers - Contact Tech Writing - Gen. by Atlassian Confluence |