开发者

How can I Set "cookieName" attribute of the "sessionState" XML element in my web.config programatically

开发者 https://www.devze.com 2023-01-11 15:17 出处:网络
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 开发者_如

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..

0

精彩评论

暂无评论...
验证码 换一张
取 消