Special Considerations Regarding Web Applications for .NET Clients

Skip to end of metadata
Go to start of metadata

By default, session-state values and information are stored in memory within the ASP.NET process. ASP.NET also provides session-state providers that allow you to use a session-state server that keeps session data in a separate process, or you can persist session state data to a SQL database. However, with ASP.NET 2.0, you can create custom session-state providers that allow you to customize how session-state data is stored in your ASP.NET applications.

Coherence for .NET includes a custom SessionStateStoreProvider implementation that uses a Coherence cache to store session state. This makes Coherence for .NET the best solution for any large ASP.NET application running within a web farm. Other options in this scenario are to use the StateServer, which introduces a single point of failure for the whole web farm, or to use the SqlServerStateProvider, which theoretically can be clustered, but is extremely slow and scales only to a certain point. Also, unlike both StateServer and SqlServerStateProvider, the CoherenceSessionProvider supports Session.End event through cache events - only the InProc one supports this, but it cannot be used in a web farm environment.

The only requirement of the CoherenceSessionStore is that all objects stored in the session must be serializable (.NET serializable, not POF). This same requirement applies to both out-of-proc session stores provided by Microsoft, so modifying any existing ASP.NET 2.0 application that uses StateServer or SqlServerStateProvider to use the CoherenceSessionStore is as simple as adding the following to the Web.config file:

Note that no code changes are required within the application itself.

CoherenceSessionProvider doesn't support calling Session_OnEnd event by default, so in order to configure provider to send this event, the sessionEndEnabled attribute should be set to true:

If your web application uses Coherence for .NET (either directly, via the CoherenceSessionProvider, or both), you must remember to call CacheFactory.shutdown() when your application terminates. To make this easier, Coherence for .NET includes an HTTP module that will automatically call CacheFactory.shutdown() when your web application exits. To use the CoherenceShutdownModule simply include it in your Web.config file:

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.