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:
Click the "Generate Keys" button to get your keys.
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://*.com/questions/19166599/asp-net-identity-cookie-across-subdomains
Asp.Net Identity介绍:http://www.360doc.com/content/17/0227/08/1355383_632319876.shtml
Asp.Net Identity cookie共享的更多相关文章
-
MVC6 (ASP.NET5) 认证 (Asp.net identity) cookie模式 自定义认证
1.Startup类的Configure方法中, app.UseIdentity(); 改为 app.UseCookieAuthentication(options => { options.A ...
-
ASP.NET Core 2.0 多应用实现Cookie共享
前言 .NET Core 2.0 发布之后,在Authentication中间件部分,相关API有不少改动(官方文档),本文主要讲的就是实现应用Cookie共享,对Cookie中间件使用不了解的可以去 ...
-
.NET跨平台之旅:ASP.NET Core从传统ASP.NET的Cookie中读取用户登录信息
在解决了asp.net core中访问memcached缓存的问题后,我们开始大踏步地向.net core进军——将更多站点向asp.net core迁移,在迁移涉及获取用户登录信息的站点时,我们遇到 ...
-
【ASP.NET Identity系列教程(二)】运用ASP.NET Identity
注:本文是[ASP.NET Identity系列教程]的第二篇.本系列教程详细.完整.深入地介绍了微软的ASP.NET Identity技术,描述了如何运用ASP.NET Identity实现应用程序 ...
-
ASP.NET Identity 二 (转载)
来源:http://www.cnblogs.com/r01cn/p/5180892.html#undefined 推荐看原文,这里转载是怕好文章消失了. 注:本文是[ASP.NET Identity系 ...
-
ASP.NET Identity系列教程-3【运用ASP.NET Identity】
https://www.cnblogs.com/r01cn/p/5180892.html 14 运用ASP.NET Identity In this chapter, I show you how t ...
-
MVC5 - ASP.NET Identity登录原理 - Claims-based认证和OWIN
在Membership系列的最后一篇引入了ASP.NET Identity,看到大家对它还是挺感兴趣的,于是来一篇详解登录原理的文章.本文会涉及到Claims-based(基于声明)的认证,我们会详细 ...
-
ASP.NET Identity入门系列教程(一) 初识Identity
摘要 通过本文你将了解ASP.NET身份验证机制,表单认证的基本流程,ASP.NET Membership的一些弊端以及ASP.NET Identity的主要优势. 目录 身份验证(Authentic ...
-
[转]MVC5 - ASP.NET Identity登录原理 - Claims-based认证和OWIN
本文转自:http://www.cnblogs.com/jesse2013/p/aspnet-identity-claims-based-authentication-and-owin.html 在M ...
随机推荐
-
零基础如何学习java更有效呢?
零基础学java,不知道该如何入手?也不知道学习的方向,很多人会问零基础怎么样学习,有没有什么入门的书籍推荐:只要方法正确,零基础学好java也是有机会的哦. 一.理解Java思想 Java是一门面向 ...
-
Java中引用类 strong reference .SoftReference 、 WeakReference 和 PhantomReference的区别
当在 Java 2 平台中首次引入 java.lang.ref 包,其中包含 SoftReference . WeakReference 和 PhantomReference 三个引用类,引用类的 ...
-
使用GitHub进行团队合作
原文: Team Collaboration With GitHub GitHub已经成为的一切开放源码软件的基石.开发人员喜欢它,基于它进行协作,并不断通过它开发令人惊叹的项目.除了代码托管,G ...
-
Convert.ToInt32()和int.Parse()区别
Convert.ToInt32()和int.Parse()都可以数据转换个int类型,区别在于: 1. Convert.ToInt32()将object类类型转换成int类型,例如:Convert.T ...
-
清除SqlServer日志
--在SQL2008中清除日志就必须在简单模式下进行,等清除动作完毕再调回到完全模式. USE [master]GO --GPSLocus是要清除日志的数据库名称ALTER DATABASE [DbN ...
-
libvirt虚拟库
转载自:https://www.ibm.com/developerworks/cn/linux/l-libvirt/index.html Libvirt 虚拟化库剖析 讲到向外扩展计算(比如云计算 ...
-
SPOJ - TSUM 母函数+FFT+容斥
题意:n个数,任取三个加起来,问每个可能的结果的方案数. 题解:构造母函数ABC,比如现在有 1 2 3 三个数.则 其中B表示同一个数加两次,C表示用三次.然后考虑去重. A^3表示可重复地拿三个. ...
-
NHibernate初学者指南系列文章导航
NHibernate初学者指南系列文章导航 前面的话 经过三个多周的时间,终于将这个系列完成了,谢谢大家的关注和支持,有很多不足之处还望大家包涵. 本系列参考的书籍为NHibernate 3 Be ...
-
java一维数组作业
package zuoYe; import java.util.Scanner; public class MaxSubArray { public static void main(String[] ...
-
Java数据类型的转换
Java数据类型,从小到大排序 byte ,short ,int ,long ,float, double,char 1.小数据类型转换大的数据类型,自动转换 int a = 3; double b ...