zoukankan      html  css  js  c++  java
  • Asp.Net Identity cookie共享

    n the Startup.Auth.cs file, add the CookieDomain parameter with your domain:

    var cookieAuthenticationOptions = new CookieAuthenticationOptions
    {
        AuthenticationType  = DefaultAuthenticationTypes.ApplicationCookie,
        LoginPath           = new PathString("/Account/Login"),
        CookieDomain        = ".mydomain.com"
    };
    

    Then for all websites you need to set a unique machine key. The easiest way to generate a new one is using IIS:

    Find the "Machine Key" option on your site:

    Click the "Generate Keys" button to get your keys.

    In the Startup.Auth.cs file, add the CookieDomain parameter with your domain:

    var cookieAuthenticationOptions = new CookieAuthenticationOptions
    {
        AuthenticationType  = DefaultAuthenticationTypes.ApplicationCookie,
        LoginPath           = new PathString("/Account/Login"),
        CookieDomain        = ".mydomain.com"
    };
    

    Then for all websites you need to set a unique machine key. The easiest way to generate a new one is using IIS:

    Find the "Machine Key" option on your site:

    enter image description here

    Click the "Generate Keys" button to get your keys.

    enter image description here

    Finally, the above process will add the following to your web.config and you need to ensure that this is copied into each of your sites.

    <machineKey
      validationKey="DAD9E2B0F9..."
      decryptionKey="ADD1C39C02..."
      validation="SHA1"
      decryption="AES"
    />
    原文地址:https://stackoverflow.com/questions/19166599/asp-net-identity-cookie-across-subdomains
    Asp.Net Identity介绍:http://www.360doc.com/content/17/0227/08/1355383_632319876.shtml
  • 相关阅读:
    C#里边的控件缩写大全(比较规范)
    jQuery的一些备忘
    有趣的史实~
    值类型 VS 引用类型~
    一道笔试题和UML思想 ~
    数据绑定以及Container.DataItem几种方式与用法分析
    用户控件与自定义控件的异同
    .NET资源站点汇总~
    C#中抽象类和接口的区别
    弹出窗口的一些东西(一),备忘~
  • 原文地址:https://www.cnblogs.com/slyzly/p/8723256.html
Copyright © 2011-2022 走看看