拥有.net成员资格的跨Web域登录 [英] Cross web domain login with .net membership

查看:61
本文介绍了拥有.net成员资格的跨Web域登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前有三个网站都在同一个数据库中运行

I currently have three websites all running from the same DB

示例网站:

  • www.mysite.com
  • admin.mysite.com
  • members.mysite.com

现在,因为它们都是从单个数据库运行的,所以它们都使用相同的.net成员资格表.

now because this all runs from a single DB they all use the same .net Membership tables.

  • 所有成员都扮演一个角色:成员
  • 所有管理员都在一个角色中:管理员

因此,管理员可以登录到管理站点并访问其所有管理功能等,但是如果成员尝试登录到管理区域,则这些成员会跳回登录屏幕而没有任何消息,我想做的是将他们重定向到站点:members.mysite.com,并让他们登录.

So the admins can log into the admin site and access all their admin functions etc, but the members if they tried to log into the admin area are bounced back to the login screen without any message, what I want to happen is to redirect them to the site: members.mysite.com and have them logged in.

我可以将它们发送到管理站点中执行response.redirect('http://members.mysite.com');的页面,但随后必须再次登录.

As I could send them to a page in the admin site that does a response.redirect('http://members.mysite.com'); but then they have to login again.

那么有什么好方法可以做到这一点,还是我会用querystring做一些不安全和棘手的事情?

So is there any good way to do this, or am I left doing something unsecure and hacky with querystring?

推荐答案

Querystring很好,只要您使用唯一的一次性令牌",该令牌在用于执行登录后便会被删除(这是Google的操作方式)

Querystring is fine as long as you use a unique 'one time token' that gets deleted after it's used to perform the login (this is how Google does it).

编辑-基本过程是

  1. 生成加密安全令牌
  2. 将令牌/用户名组合存储在数据库中
  3. 使用?token = XXXXXXXXXXXXXXXX重定向到新站点
  4. 新站点看到令牌,在数据库中查找匹配的用户名并删除令牌
  5. 以该用户身份执行登录过程

这篇关于拥有.net成员资格的跨Web域登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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