c# - 如何自定义 Forms Authentication cookie 名称?

标签 c# asp.net forms-authentication

我有 2 个网站在不同端口的本地主机上运行。由于浏览器在发送 cookie 时不区分端口号,我从一个站点发送的表单例份验证票据被发送到另一个站点

我该如何解决这个问题?我认为一个好的解决方案是更改表单例份验证票证或其中一个网站,但我不知道该怎么做。

最佳答案

在你的 web.config 中:

<authentication mode="Forms">
  <forms name="{WhateverCookieNameYouWant}" loginUrl="LogOn.aspx" />
</authentication>

关于c# - 如何自定义 Forms Authentication cookie 名称?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3631617/

相关文章:

asp.net - 我可以确定 HttpModules 是按照它们在 HttpApplication.Modules 集合中列出的顺序执行的吗?

asp.net - Elmah nuget 包不更新 web.config

asp.net - 将 ASP.Net 身份验证与 ASP.Net MVC 结合使用有什么真正的好处吗?

php - 数据使用$_REQUEST是不是错了?

c# - 在 C# 中从禁用的 ListView 启用滚动条

c# - 重叠 Socket.BeginSend/EndSend 调用的可预测行为

c# - 给定一个Applications Insight Instrumentation key ,获取Azure中的服务名称

c# - 访问模板化用户控件 ASP.NET 中的子控件

asp.net - 有没有办法我仍然可以在我的 ASP.NET MVC 2 项目中使用 app_offline.htm?如果没有,是否有替代方法?

asp.net - HttpContext.Current.User.Identity.Name 在同一网站的所有应用程序之间共享 : isn't this insecure?