【问题标题】:Using Forms Authentication with localhost with WebForms将表单身份验证与 localhost 与 WebForms 一起使用
【发布时间】:2016-02-23 14:46:29
【问题描述】:

我正在开发一个使用表单身份验证的旧应用程序,我正在尝试让它在 Visual Studio 2012 中作为网站在本地工作。使用http://localhost:54006/ 上的内部调试器似乎可以正常运行。图像、html 等被提供。不幸的是,登录时,我认为有一些 cookie 问题阻止它认为我已登录。我注意到在web.config 中有错误的domain 设置。我已将其更改为读取 localhost,但我仍然没有任何运气。

<authentication mode="Forms">
        <forms loginUrl="/" path="/" slidingExpiration="true" timeout="480" name=".ASPXAUTH_ADD" domain=".localhost" enableCrossAppRedirects="true">
        </forms>
    </authentication>

http://localhost:54006/ 的 Visual Studio 中运行该设置是否可行?它不会抱怨用户名或密码错误。它在生产环境中使用不同的域属性集。 localhost ".localhost" 的域属性是否正确?

提前感谢您的帮助或指导。

编辑:我能够通过简单地删除域属性而不是尝试设置它来使其工作。为什么这行得通?

【问题讨论】:

    标签: asp.net .net visual-studio-2012 webforms forms-authentication


    【解决方案1】:

    "获取表单身份验证 cookie 的域的值。" "默认值为当前域。"

    msdn example 给出值“contoso.com”。

    看起来像一个很好的最佳答案here(更详细)。 另一个(类似)答案here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-07-10
      • 2011-03-12
      • 1970-01-01
      • 2012-03-15
      • 2013-02-10
      • 2020-03-12
      相关资源
      最近更新 更多