如何将会话详细信息共享到多个域? [英] How to share a session details to multiple domain?

查看:82
本文介绍了如何将会话详细信息共享到多个域?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个不同域名的网站.1是www.example.com,第二个是test.example.com两个都包含相同的学生详细信息但是当我登录第一个网站时我想将该会话详细信息分享给第二个网站。

I have two website with different domain.1 is www.example.com and 2nd is test.example.com both are contain same student details but when i login into 1st website i wanted to share that session details to 2nd website.

推荐答案

会话您可以做的是将数据发布到第二个站点并将其放入第二个应用程序的会话变量中。



或者,如果您只询问并且特别是关于子域网站,则可以使用域cookie。像这样的东西

Response.Cookies(CookieName)。Domain =。example.com



请记住,cookie有大小限制虽然。



了解更多信息 [ ^ ]



如果这有帮助,请花时间接受解决方案。谢谢。
Session What you CAN do is post the data to your second site and put it in session variable in the second application.

Or you can use domain cookie if you're asking only and specifically about subdomain sites. Something like this
Response.Cookies("CookieName").Domain = ".example.com"

Remember that cookies have size limits though.

Learn more here[^]

If this helps please take time to accept the solution. Thank you.


如果您有IIS基础结构,则可以在服务器之间共享会话状态。请看这里: http:// dotnetcodr.com/2013/07/01/web-farms-in-net-and-iis-part-5-session-state-management/ [ ^ ]。br />


但我不确定,这就是你需要的。看起来您需要SSO(单点登录)。有几种实现方式,所以你应该环顾四周。同样的想法:

企业单点登录 [ ^ ]

跨域ASP.NET应用程序的单点登录(SSO):第二部分 - 实现 [ ^ ]
If you have IIS infrastructure, you can share session state between servers. Look here: http://dotnetcodr.com/2013/07/01/web-farms-in-net-and-iis-part-5-session-state-management/[^].

But I am not sure, this is what you need. It looks like you need SSO (single sign-on). There are several implementations of it, so you should look around. Just as idea:
Enterprise Single Sign-On[^]
Single Sign On (SSO) for cross-domain ASP.NET applications: Part-II - The implementation[^]


你可以做它有两种替代方式



第一种:将会话值存储在cookie中并在子域中检索



第二步:将查询字符串传递给您的子域并将其用作会话



假设您的子域名是test.domain.com来自domain.com的传递查询



test.domain.com?que ry = XXXXX并在test.domain.com页面加载事件



Session [abc] = Request.quesryString [query];
You can do it in two alternate ways

First: Store session value in cookie and retrieve in your sub domain

Second: Pass query string to your sub domain and use it as session there

Suppose your sub domain is test.domain.com the pass query from domain.com like this

test.domain.com?query=XXXXX and in test.domain.com on page load event

Session["abc"]=Request.quesryString["query"];


这篇关于如何将会话详细信息共享到多个域?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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