zoukankan      html  css  js  c++  java
  • 【记录】ASP.NET MVC 4/5 Authentication 身份验证无效

    在 ASP.NET MVC 4/5 应用程序发布的时候,遇到一个问题,在本应用程序中进行身份验证是可以,但不能和其他“二级域名”共享,在其他应用程序身份验证,不能和本应用程序共享,示例代码:

    System.Web.Security.FormsAuthentication.SetAuthCookie("蟋蟀", true);
    

    webconfig 配置如下:

    <system.web>
        <pages validateRequest="false"></pages>
        <authentication mode="Forms">
            <forms name=".DottextCookie" domain=".test.com" loginUrl="~/Account/Login" protection="All" />
        </authentication>
        <compilation debug="true" targetFramework="4.5.1" />
        <httpRuntime targetFramework="4.5.1" requestValidationMode="2.0" />
      </system.web>
    

    比较“奇葩”的解决方式是:把 httpRuntime 节点中的“targetFramework="4.5.1"”去掉就好了,HttpRuntime.TargetFramework 属性参考:system.web.httpruntime.targetframework,感觉应该是应用程序的 Framework 版本和服务器 Framework 版本不一致所引起的,至于具体原因,尚不得知!

  • 相关阅读:
    周报说明8-4
    周报7-28
    日志-maven-c监控 周报7-21
    证明创建runnable实例和普通类时间一样长, 其实吧
    UE4开始之路
    js简单框架设计
    json中key为数字会自动排序问题
    u3动画
    工厂模式
    单例模式
  • 原文地址:https://www.cnblogs.com/xishuai/p/httpruntime-targetFramework-authentication-failed.html
Copyright © 2011-2022 走看看