ASP.NET站点之间共享认证 [英] Sharing Authentication between ASP.NET sites

查看:81
本文介绍了ASP.NET站点之间共享认证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个ASP.NET网站(他们不能在同一个进程中运行),我需要他们之间共享的认证。如果用户在站点A已经通过身份验证,然后进入到站点B,我需要有一种方法来与网站B股此信息,以便用户不会要求再次进行身份验证。也是同样的道理两种方式。你如何分享这些信息?

I have two ASP.NET sites (they can not run in the same process) and I need to share authentication between them. If a user is in site A already authenticated and then goes to site B, I need to have a way to share this information with site B so the user is not asked to authenticate again. The same is true both ways. How do you share this information?

推荐答案

他们是在同一个域中?

如果您有app1.blah.com和app2.blah.com,这是非常容易做到的。刚才设置的域名和名字在w​​eb.config中的窗体的部分相同的值:

If you have app1.blah.com and app2.blah.com, it's very easy to do. Just set the domain and the name to the same value in the forms-section in web.config:

<authentication mode="Forms">
      <forms loginUrl="login.aspx"
        name=".COOKIENAME" 
        protection="All"  
        path="/" 
        domain="blah.com" 
        timeout="30" />
    </authentication>

另外一个好处是,用户可以登录任一站点,并仍将进行身份验证,如果他们去另一个。

An added benefit is that users can sign into either site and will still be authenticated if they go to the other one.

这篇关于ASP.NET站点之间共享认证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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