gpt4 book ai didi

asp.net - cookies 。区分大小写的路径。如何重写 URL

转载 作者:行者123 更新时间:2023-12-02 13:18:35 24 4
gpt4 key购买 nike

我们拥有大量应用程序 (>50),所有应用程序都在单个域下运行,但具有不同的虚拟目录。相当标准的东西。我们使用路径存储 cookie,以按应用程序隔离 cookie。路径设置为应用程序路径。

只要 URL 的大小写与应用程序路径相同,这似乎就可以正常工作。如果不同,浏览器将无法检索 cookie 集合。

是否有任何非常基本的方法(ISAPI?全局 ASAX?)来重写所有 URL,以便它们与应用程序路径匹配?理想情况下,这是可以在应用程序级别配置的。

目前停留在 IIS6 上。

谢谢

最佳答案

想知道这是否是一个可能的(甚至是一个好的)解决方案:

在 Global.asax 中:

void Application_BeginRequest(object sender, EventArgs e)
{
string url = HttpContext.Current.Request.Url.PathAndQuery;
string application = HttpContext.Current.Request.ApplicationPath;

if (!url.StartsWith(application))
{
HttpContext.Current.Response.Redirect(application + url.Substring(application.Length));
}
}

关于asp.net - cookies 。区分大小写的路径。如何重写 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1121695/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com