在站点之间传递信息 [英] Passing Info Between Sites

查看:74
本文介绍了在站点之间传递信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在为我们的主站点建立一个姐妹站点.这个姐妹网站正被用来帮助该公司做更多的广告宣传,以便更好地在Google上上市.基本上,姊妹站点将只具有内容丰富的静态页面,用户可以看到我们提供的内容和不提供的内容.我要完成的主要事情(一旦他们注册)是允许用户从该姊妹站点登录并验证该用户的身份,然后将其重定向到我们的主站点.我的问题是我不知道如何执行此操作,因为Session变量不会跨域.他们将被重定向到的页面使用从数据库中检索到的数据的Session变量(对于此登录用户而言是唯一的),以便能够从应用程序的每个页面中识别此人.我想做的是从姐妹站点存储所需的Session变量,以便当重定向到主站点的下一个必需页面时,一切都将正常工作,就像用户从主站点登录一样.我们只想这样做,这样用户就不必单击姊妹站点上的登录"按钮,然后将其重定向到我们主站点的登录"页面,然后他们必须登录.有关如何执行此操作的任何建议?

谢谢,

Brad

解决方案

您想要的是可能的. [此处 [此处 [^ ],在这种情况下,您可以写入任何您喜欢的后备存储.


您要做的是通过加密的查询字符串将用户凭据传递到主站点.

如果两个站点位于同一网络(或计算机)上,并且它们可以访问同一数据库,则相对容易.您可以按照Keith Barrow的建议进行操作,并将会话存储在数据库中并在站点之间共享整个会话,也可以拥有一个表,供两个站点查看,这是预身份验证信息–也就是说,如果第二个站点可以从第一个站点找到该用户信息,则它将使用有效的用户信息来初始化会话.在这种情况下,从第一个站点到第二个站点的链接将包含标识要查找内容的某种令牌.


Hello All,

I am building a sister site to our main site. This sister site is being used to help advertise the company more so to gain better listing with Google. Basically the sister site is just going to have informative static pages that the user can see what we have to offer and what-not. The main thing I am trying to accomplish (once they sign-up) is to allow the user to login from this sister site and authenticate that user then redirect them to our main site. My problem is that I do not know how to do this since Session variables do not go across domains. The page that they will get redirected to uses Session variables of data retrieved from the database (that is unique for this logged in user) to be able to identify this person from every page in the application. What I would like to do is store the needed Session variables from the sister site so that when get re-directed to next required page of main site that everything just works as though the user logged on from the main site. We would like to do this just so the user does not have to click a "Log-in" button from the sister site and then get redirected to our Log-in page of our main site where they will then have to login. Any suggestions on how to do this?

Thanks,

Brad

解决方案

What you want is possible. This[^] is a very good article on session handling. The part that is most relevant to you is here[^], you can store session in an SQL server. This is intended for web-farms/load balanced environments, but it should cover your scenario.

If you can''t use the SQL Session Mode, your other option is to hand-roll your own custom provider, described here[^], in this case you can write to any backing-store you like.


What you want to do is to pass the user credentials to the main site via an encrypted querystring.


If the two sites are on the same network (or machine), and they can access the same database, it is relatively easy. You can either do as Keith Barrow suggests and store your session in the database and share whole sessions between sites, or you can have a table that both sites look at which is pre-authentication information – i.e. the second site will initialise a session with valid user information if it can find that information from the first site. In this case links from the first site to the second would include some type of token that identified what to look up.


这篇关于在站点之间传递信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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