如何不混合部署在Intranet上的ASP.NET网站的cookie [英] How to not mix cookies of ASP.NET websites deployed on intranet

查看:62
本文介绍了如何不混合部署在Intranet上的ASP.NET网站的cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前在同一台服务器上使用IIS 10在我的公司内部网上部署了3个网站。服务器正在运行Windows 10 PRO



用户使用应用程序链接访问应用程序说

App1 - http://1.1.1.1 :161 / App1 / Login.aspx

App2 - http://1.1.1.1:162/App2/Login.aspx

App3 - http://1.1.1.1 :163 / App3 / Login.aspx



所有应用程序都有登录页面并在浏览器上存储cookie。

问题是当这些cookie为同一浏览器中的所有3个应用程序创建所有3个应用程序cookie对所有应用程序可见。哪个不好?



如何从App2&中隐藏App1 cookie App1和App的App3和App2 cookie App1和App的App3和App3 cookie App2



我没有在任何应用中使用HTTPS / SSL。但有些cookie无法通过javascript阅读。



真正的问题是,当退出应用程序时,所有应用程序的所有Cookie都会在退出任何应用程序时被清除。



请帮助



我尝试过的事情:



等待社区的一些建议没有那么多

I currently have 3 websites deployed on my companies intranet using IIS 10 on the same server. Server is running Windows 10 PRO

Users access the app using a link to the app say
App1 - http://1.1.1.1:161/App1/Login.aspx
App2 - http://1.1.1.1:162/App2/Login.aspx
App3 - http://1.1.1.1:163/App3/Login.aspx

All apps have login pages and store cookies on the browser.
The problem is when these cookies are created for all the 3 apps in the same browser all 3 apps cookies are visible to all of the apps. Which is bad?

How do I hide App1 cookies from App2 & App3 and App2 cookies from App1 & App3 and App3 cookies from App1 & App2

I am not using HTTPS/SSL in any of the Apps. But some cookies are not readable via javascript.

The real issue is that when logging out of the apps all the cookies of all apps get cleared when logging out of any app.

Kindly help

What I have tried:

Nothing as much waiting for some suggestion from community

推荐答案

也许你可以在每个应用程序中使用GUID来唯一识别特定于应用程序的cookie而不是userID。
Maybe you could use a GUID in each app to uniquely identify the app-specific cookie instead of the userID.


设置Cookie.Path以匹配每个应用程序路径?
Set the Cookie.Path to match each app path?


如果您使用表单身份验证,

在每个应用程序的web.config中设置如下唯一的cookie名称:



if you are using forms authentication,
in each app's web.config set unique cookie name as follows:

<authentication mode="Forms">
  <forms name=".CookieName" loginUrl="LoginPage.aspx" />
</authentication>


这篇关于如何不混合部署在Intranet上的ASP.NET网站的cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆