How can I Set "cookieName" attribute of the "sessionState" XML element in my web.config programatically
Multiple applications are sharing the same session cookie at the moment and I don't want this to be the case, however, I would like to set the value in code rathr than hardcode a value using 开发者_如何转开发the web.config.
Does anyone know how thi can be done?
You can place application specific config files in each application folder and then reference them like this in the web.config:
<authentication configSource="auth.config"></authentication>
In each auth.config, you can then do what you need:
<?xml version="1.0"?>
<authentication mode="Forms">
<forms loginUrl="app1_login.aspx" timeout="60" name=".APP1" path="/app1" />
</authentication>
This is how you get it: How to programmatically get session cookie name? but you can surely set it as well..
精彩评论