EDIT (clarifying my question): Is there an API or method with which we can use the Out Of Process Asp.NET State Service from our own code or is that proprietary?
We are looking into implementing a custom session state module that re-uses the components of the module that comes stock with asp. Our main goal is to just prevent session locking (without changing the session state mode to ReadOnly). Is this possible?
One of the key pieces that we would like to make work is to be able to use the same Out of Proc Session storage provider (The ASP State service) that is used internally by .NET as we have a load-balanced environment that doesn't use sticky sessions.
I have dug into the code over in the reference source, and my findings are below. I am hoping somebody has a different utility that could potentially be used to integrate a custom session state module the ASP State Service.
The default session Module is System.Web.SessionState.SessionStateModule
. This is a Sealed
class. This class appears to be the only class that uses the SessionStateMode.StateServer
enum value (which is specified in the web config).
When this flag is set, the module sets the _store
variable to be a new System.Web.SessionState.OutOfProcSessionStateStore
which is a Friend Sealed
class.
I had initially had a few thoughts on how to do this, and because of the modifiers on the classes above I was unable to do these. Are there other approaches that could be taken?
- Instantiate a new
System.Web.SessionState.SessionStateModule
and reference the_store
variable. This did not work, obviously because the_store
variable is private. - I tried creating a class which inherits from
System.Web.SessionState.SessionStateModule
but obviously since it issealed
that does not work. - Looked at copying the code from the .NET framework code. Realized that would be a very poor decision.
Are there any options I am missing?