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 ...
随机推荐
- selenium之关于 chromedriver的安装和使用
转自:https://blog.csdn.net/d77808675/article/details/79016271 最近在学习爬虫,用到了selenium 环境:Windows,python3 但 ...
- Knockout.Js官网学习(checked 绑定)
前言 checked绑定是关联到checkable的form表单控件到view model上 - 例如checkbox(<input type='checkbox'>)或者radio bu ...
- Android四大组件应用系列——Activity与Service交互实现APK下载
Servic与Activity相比它没有界面,主要是在后台执行一些任务,Service有两种启动方法startService()和bindService(),startService方式Service ...
- Nginx——使用 Nginx 提升网站访问速度【转载+整理】
原文地址 本文是写于 2008 年,文中提到 Nginx 不支持 Windows 操作系统,但是现在它已经支持了,此外还支持 FreeBSD,Solaris,MacOS X~ Nginx(" ...
- vim IDE配置
参考: http://www.cnblogs.com/witcxc/archive/2011/12/28/2304704.html http://www.cnblogs.com/ma6174/arch ...
- Android 自定义TextView 实现文本间距
Android系统中TextView默认显示中文时会比较紧凑,不是很美观.为了让每行保持一定的行间距,可以设置属性android:lineSpacingExtra或android:lineSpacin ...
- [转]POJ3624 Charm Bracelet(典型01背包问题)
来源:https://www.cnblogs.com/jinglecjy/p/5674796.html 题目链接:http://bailian.openjudge.cn/practice/4131/ ...
- grep与孪生兄弟egrep差异
egrep是对grep的功能扩展,让其支持正则更加完美! #grep与egrep不同 egrep完全支持正则 ls |grep -i '[a-z]\{3\}' === ls |egrep -i ...
- sed学习[参考转载]
一.选项与参数: -n :使用安静(silent)模式.在一般 sed 的用法中,所有来自 STDIN 的数据一般都会被列出到终端上.但如果加上 -n 参数后,则只有经过sed 特殊处理的那一行(或者 ...
- 合理设置apache httpd的最大连接数
来自:http://hi.baidu.com/rainchen/blog/item/095f0a551fa802c5b645ae46.html 手头有一个网站在线人数增多,访问时很慢.初步认为是服务器 ...