如何设置“cookieName” “sessionState”的属性以编程方式在我的 web.config 中添加 XML 元素

发布于 2024-09-14 11:46:11 字数 100 浏览 1 评论 0原文

目前多个应用程序共享同一个会话 cookie,我不希望出现这种情况,但是,我想在代码中设置该值,而不是使用 web.config 硬编码一个值。

有谁知道如何做到这一点?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

埖埖迣鎅 2024-09-21 11:46:11

您可以将应用程序特定的配置文件放置在每个应用程序文件夹中,然后在 web.config 中像这样引用它们:

<authentication configSource="auth.config"></authentication>

在每个 auth.config 中,您可以执行您需要的操作:

<?xml version="1.0"?>
<authentication mode="Forms">
    <forms loginUrl="app1_login.aspx" timeout="60" name=".APP1" path="/app1" />
</authentication>

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>
时光无声 2024-09-21 11:46:11

这是你得到它的方法:
如何以编程方式获取会话 cookie 名称?
但你当然也可以设置它..

This is how you get it:
How to programmatically get session cookie name?
but you can surely set it as well..

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文