S
Steve Franks
Can someone please advise on how I can add logic that dynamically sets the
session state's cookie mode to UseUri or UseCookies on a per user basis?
In other words, depending on our business rules and logic, there are times
when I need to set a particular visitor's session to use the URL encoding
(CookieMode.UseUri) instead of using cookies. Yes I know there is an auto
type setting but that is not applicable to our needs. There are also
settings in web.config but again these settings apply to ALL sessions, and
instead I want the ability to use difference cookie modes for different
users.
From the ASP.NET 2.0 beta docs it looks like this can be done by creating a
class which implements the IHttpSessionState, as the CookieMode property of
the IHttpSessionStateContainer can be easily set from there. However to use
my own IHttpSessionStateContainer the docs say I have to replace the default
SessionStateModule with my own. That would be overkill because the default
SessionStateModule and HttpSessionStateContainers are perfect as-is... I
just need to tap in to the CookieMode property to control how it is set.
And the SessionStateModule is sealed, so if I understand correctly I simply
cannot create a new class and derrive from the default SessionStateModule -
so I would then have to code one from scratch? And as would be expected I
simply cannot set the CookieMode property in the Session object
after-the-fact, as that is a read-only property at that point.
Can somone please advise me on the most straight-forward way to tap into
this default session state management in ASP.NET 2.0 so I can dynamically
set the CookieMode individually for each user as needed (between
CookieMode.UseUri vs .UseCookies), based on my own rules?
Thanks!
Steve
session state's cookie mode to UseUri or UseCookies on a per user basis?
In other words, depending on our business rules and logic, there are times
when I need to set a particular visitor's session to use the URL encoding
(CookieMode.UseUri) instead of using cookies. Yes I know there is an auto
type setting but that is not applicable to our needs. There are also
settings in web.config but again these settings apply to ALL sessions, and
instead I want the ability to use difference cookie modes for different
users.
From the ASP.NET 2.0 beta docs it looks like this can be done by creating a
class which implements the IHttpSessionState, as the CookieMode property of
the IHttpSessionStateContainer can be easily set from there. However to use
my own IHttpSessionStateContainer the docs say I have to replace the default
SessionStateModule with my own. That would be overkill because the default
SessionStateModule and HttpSessionStateContainers are perfect as-is... I
just need to tap in to the CookieMode property to control how it is set.
And the SessionStateModule is sealed, so if I understand correctly I simply
cannot create a new class and derrive from the default SessionStateModule -
so I would then have to code one from scratch? And as would be expected I
simply cannot set the CookieMode property in the Session object
after-the-fact, as that is a read-only property at that point.
Can somone please advise me on the most straight-forward way to tap into
this default session state management in ASP.NET 2.0 so I can dynamically
set the CookieMode individually for each user as needed (between
CookieMode.UseUri vs .UseCookies), based on my own rules?
Thanks!
Steve