第一种方式,修改forms的name

how to set the forms authentication cookie path

assume you have already solved this issue somehow, but since I stumbled upon this question I thought I should add my few cents.

To solve the issue use different cookie names in web.config. Something like:

<authentication mode="Forms">
<forms name=".ASPXFORMSAUTH_FOO"
loginUrl="public/login.aspx" cookieless="UseCookies" slidingExpiration="true"/>
</authentication>

and

<authentication mode="Forms">
<forms name=".ASPXFORMSAUTH_BAR"
loginUrl="public/login.aspx" cookieless="UseCookies" slidingExpiration="true"/>
</authentication>

第二种方式,修改forms的path,并且加上domain(必须添加)  (forms的name是保持一致的)

需要注意的是,监视cookie的时候,每一个页面的cookie是独立的,需要分别用F12查看。

The name of forms keep the same, they have different path,(although the domains are the same but must set it)
<authentication mode="Forms">
<forms loginUrl="CMSPages/LISA_logon.aspx" defaultUrl="Default.aspx" name=".ASPXFORMSAUTH" timeout="1440" slidingExpiration="true" domain="localhost" path="/LISA_50_Dev_CMSWeb" />
</authentication>

<authentication mode="Forms">
<forms loginUrl="CMSPages/logon.aspx" defaultUrl="Default.aspx" name=".ASPXFORMSAUTH" timeout="1440" slidingExpiration="true" domain="localhost" path="/LISA_60_Dev_CMSWeb"/>
</authentication>

第二个方法的问题,在于限定了domain name,如果限定为localhost的话,那么会导致使用域名无法登录的问题 。因为后台不识别了。

扩展

查看单个页面的cookie

相关文章

https://weblog.west-wind.com/posts/2008/Jan/20/Forms-Authentication-and-path-in-the-forms-Tag

https://docs.microsoft.com/en-us/aspnet/web-forms/overview/older-versions-security/introduction/forms-authentication-configuration-and-advanced-topics-cs

domain

When using cookie-based authentication tickets, this setting specifies the cookie's domain value.

The default value is an empty string, which causes the browser to use the domain from which it was issued (such as www.yourdomain.com).

In this case, the cookie will not be sent when making requests to subdomains, such as admin.yourdomain.com.

If you want the cookie to be passed to all subdomains you need to customize the domain attribute setting it to yourdomain.com.

path

When using cookie-based authentication tickets, this setting specifies the cookie's path attribute.

The path attribute enables a developer to limit the scope of a cookie to a particular directory hierarchy.

The default value is /, which informs the browser to send the authentication ticket cookie to any request made to the domain.

multiple web application host under the same website on IIS (authentication mode)的更多相关文章

  1. 基于Web的企业网和互联网的信息和应用( 1194.22 )

    基于Web的企业网和互联网的信息和应用( 1194.22 ) 原文更新日期: 2001年6月21日原文地址: http://www.access-board.gov/sec508/guide/1194 ...

  2. Web 通信 之 长连接、长轮询(long polling)(转载)

    基于HTTP的长连接,是一种通过长轮询方式实现"服务器推"的技术,它弥补了HTTP简单的请求应答模式的不足,极大地增强了程序的实时性和交互性. 一.什么是长连接.长轮询? 用通俗易 ...

  3. 极大提高Web开发效率的8个工具和建议(含教程)

    面对复杂的 Web 应用的开发,良好的流程和工具支持是必不可少的,它们可以让日常的开发工作更加顺畅.更加高效.本文介绍了6个Web开发利器以及相关的教程,帮助你在开发.调试.集成和发布过程极大地提高效 ...

  4. spring web mvc中遇到的错误以及学习小记(持续记录)

    错误:cvc-complex-type.2.4.a: 发现了以元素 'init-param' 开头的无效内容.应以 '{"http://java.sun.com/xml/ns/javaee& ...

  5. net core体系-web应用程序-4asp.net core2.0 项目实战(任务管理系统)-2项目搭建

    系统要求 首先建议采用 Windows 10 专业版/企业版/教育版,且必须是64位操作系统,原因是docker装起来比较方便,Win7装起来比较麻烦,且不确定是否有其他问题(自己没有实践过) 其次W ...

  6. [转]Web 通信 之 长连接、长轮询(long polling)

    本篇文章转载自Web 通信之长连接.长轮询(longpolling),版权归作者所有. 转者按:随着技术的发展,在HTML5中,可以通过WebSocket技术来完成长连接的开发,虽然如此,本文依然存在 ...

  7. Web 通信 之 长连接、长轮询(long polling)

    基于HTTP的长连接,是一种通过长轮询方式实现"服务器推"的技术,它弥补了HTTP简单的请求应答模式的不足,极大地增强了程序的实时性和交互性. 一.什么是长连接.长轮询? 用通俗易 ...

  8. Web 通信 之 长连接、长轮询(long polling)(转)

    基于HTTP的长连接,是一种通过长轮询方式实现"服务器推"的技术,它弥补了HTTP简单的请求应答模式的不足,极大地增强了程序的实时性和交互性. 一.什么是长连接.长轮询? 用通俗易 ...

  9. Core CLR 自定义的Host官方推荐的一种形式(第一种)

    .Net Core CLR提供两种Host API访问 托管代码的形式,按照微软官方的说法,一种是通过CoreClr.DLL来直接调用托管生成的DLL程序集,另外一种是通过CoreClr里面的C导出函 ...

随机推荐

  1. Json——Json与JS的区别

    JSON是JS的字面量的特殊表现形式,它使用文本表示 JS 对象信息,本质是字符串 var obj = {a: 'Hello', b: 'World'}; //这是一个对象,注意键名也是可以使用引号包 ...

  2. CSS——float

    float:就是在于布局,首先要介绍的是文档流(标准流),之后是浮动布局. 文档流:元素自上而下,自左而右,块元素独占一行,行内元素在一行上显示,碰到父集元素的边框换行. 浮动布局: 1.float: ...

  3. ProE复杂曲线方程:Python Matplotlib 版本代码(L系统,吸引子和分形)

    对生长自动机的研究由来已久,并在计算机科学等众多学科中,使用元胞自动机的概念,用于生长模拟.而复杂花纹的生成,则可以通过重写一定的生长规则,使用生成式来模拟自然纹理.当然,很多纹理是由人本身设计的,其 ...

  4. jquery jstree 插件的使用

    最近一个项目 需要用到jstree 这个jQuery插件,就研究了下,做目录树 菜单还是很强大的,下面对经常会用到几个用法做下说明. 1. 首先页面 引用 jquery.jstree 2. html ...

  5. (转)分布式文件存储FastDFS(五)FastDFS常用命令总结

    http://blog.csdn.net/xingjiarong/article/details/50561471 1.启动FastDFS tracker: /usr/local/bin/fdfs_t ...

  6. vue项目中使用百度地图的方法

    1.在百度地图申请密钥: http://lbsyun.baidu.com/  将 <script type="text/javascript" src="http: ...

  7. 9 Java 堆排序

    堆是具有以下性质的完全二叉树,每个结点的值都大于或等于其左右孩子结点的值,称为大顶堆:或者每个结点的值都小于或等于其左右孩子结点的值,称为小顶堆.如下图: 同时,我们对堆中的结点按层进行编号,将这种逻 ...

  8. Js—innerHTML和innerText的区别

    1.innerHTML属性和innerText属性 都是对元素的一个操作,简单讲,innerHTML可以在某种特定环境下重构某个元素节点的DOM结构,innerText只能修改文本值 在JavaScr ...

  9. 【Apache Kafka】二、Kafka安装及简单示例

    (一)Apache Kafka安装 1.安装环境与前提条件   安装环境:Ubuntu16.04   前提条件: ubuntu系统下安装好jdk 1.8以上版本,正确配置环境变量 ubuntu系统下安 ...

  10. ES6学习历程(变量的解构赋值)

    一.数组的解构赋值 1.举几个例子足以理解 let [a, b, c] = [1, 2, 3]; a:1;  b:2;  c:3; let [x, , y] = [1, 2, 3];  x:1   y ...