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:

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://stackoverflow.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 ...
随机推荐
- c# 以换行(\r\n)拆分字符串
c# 以换行(\r\n)拆分字符串 字符串数组形式: string[] striparr = strip.Split(new string[] { "\r\n" }, String ...
- unity 打包编译记录
1.放到Plugins目录下的贴图不会打包进去 2.放到Plugins目录下的dll会自动打包,代码也会打包 3.放在Resources目录下的资源会自动打包 4.放在StreamingAssets目 ...
- CustomJsonDateDeserializer @JsonDeserialize(using = CustomJsonDateDeserializer.class) Jackson 反序列化Date时遇到的问题 java中json日期属性反序列化
public class CustomJsonDateDeserializer extends JsonDeserializer<Date> { @Override public Date ...
- ThinikPhp 将数据库模型的增、删、改操作写入日志
Thinkphp中的模型可以对数据库字段进行验证规则的设置和设置一些字段的默认值(比如字段为当前时间)以及在操作数据时的的一些回调方法等 基本上每一个模型都需要设置一些验证规则和字段默认值的设置, ...
- Apache Kafka学习 (二) - 多代理(broker)集群
1. 配置server.properties > cp config/server.properties config/server-1.properties> cp config/ser ...
- 微软BI 之SSIS 系列 - Merge, Merge Join, Union All 合并组件的使用以及Sort 排序组件同步异步的问题
开篇介绍 SSIS Data Flow 中有几个组件可以实现不同数据源的数据合并功能,比如 Merger, Merge Join 和 Union All.它们的功能比较类似,同时也比较容易混淆,下面是 ...
- tensorflow 中 reduce_sum 理解
定义如下: reduce_sum( input_tensor, axis=None, keep_dims=False, name=None, reduction_indices=None ) redu ...
- 利用ConcurrentHashMap来实现一个ConcurrentHashSet
利用ConcurrentHashMap来实现一个ConcurrentHashSet package hashset; import java.io.Serializable; import java. ...
- CentOS7下 让Docker pull命令使用squid做http代理拉取目标镜像仓库的镜像
场景,如下图所示: 服务器B具有两个网卡,分别和服务器A和服务器C互通,这里想要在服务器C上借助服务器B作为桥梁,拉取镜像仓库服务器A上的镜像. 思路也很简单,在服务器上搭建HTTP代理服务,服务器C ...
- mongodb用户管理和服务安装
一.忘记密码快速找回 任何系统忘记密码都是一样的操作:以无需授权的模式开启程序,然后进入系统修改权限设置,退出来重新以授权方式开启程序.MySQL是这样,MongoDB也是这样.好的系统都提供了无授权 ...