.Net SessionState Configuration

82 Views Asked by At

Is it possible to configure multiple sessionState in my web.config?

<sessionState mode="StateServer"
                stateConnectionString="tcpip=127.0.0.1:42424"
                cookieless="false"
                timeout="20"/>
<sessionState   mode="SQLServer"
                stateConnectionString="tcpip=127.0.0.1:42424"
                cookieless="false"
                timeout="20"/>

If done so, what may be the implications?

If you are asking why do I want to do that, don't. It was done like that.

Just want to know if it is possible (it is clearly and there is no error). Will it use the first? the second? both? none?

Thanks

2

There are 2 best solutions below

0
On

It's not possible, like Brando says, but you could get around this by implementing your own SessionState-provider or, depending on the requirements, using a HttpModule and modifying the session object in the HttpContext.

1
On

No, it's impossible. If you set multiple session state. It will raise error:

Config section 'system.web/sessionState' already defined. Sections must only appear once per config file.