简体   繁体   English

如何从当前网站登录另一个网站

[英]How to login to another website from current website

There are 2 websites, Website A and B. The requirement goes like this: 有两个网站,网站A和B。需求如下:

  • Website A has a login page. 网站A有一个登录页面。
  • On successful login of Website A, the user should be redirected to Website B homepage. 成功登录网站A后,应将用户重定向到网站B主页。
  • Note: 注意:

    • The user account/credentials for both websites are same. 两个网站的用户帐户/凭据相同。
  • Although Website B has an login page, the successful login in Website A should bypass the login page of Website B and show its (Website B's) homepage. 尽管网站B具有登录页面,但在网站A中成功登录应绕过网站B的登录页面并显示其(网站B的)主页。

So my question is whether the above scenario is practially possible in C#, ASP.Net? 因此,我的问题是上述情况在C#,ASP.Net中是否切实可行?

If possible, then how can the above requirement work in following environments: - Both websites are hosted in the same domain. 如果可能,上述要求如何在以下环境中工作:-两个网站都托管在同一域中。 - Both websites are hosted in different domains. -两个网站都托管在不同的域中。

Can you please suggest me the ways of designing and implementing the above requirement. 您能否建议我设计和实现上述要求的方法。

Thanks in advance!!!. 提前致谢!!!。

There are multiple options to implement SSO for a .NET application. 为.NET应用程序实现SSO有多种选择。

Check out the following tutorials online: 在线查看以下教程:

Basics of Single Sign on, July 2012 单一登录基础知识,2012年7月

http://www.codeproject.com/Articles/429166/Basics-of-Single-Sign-on-SSO http://www.codeproject.com/Articles/429166/Basics-of-Single-Sign-on-SSO

GaryMcAllisterOnline: ASP.NET MVC 4, ADFS 2.0 and 3rd party STS integration (IdentityServer2), Jan 2013 GaryMcAllisterOnline:ASP.NET MVC 4,ADFS 2.0和第三方STS集成(IdentityServer2),2013年1月

http://garymcallisteronline.blogspot.com/2013/01/aspnet-mvc-4-adfs-20-and-3rd-party-sts.html http://garymcallisteronline.blogspot.com/2013/01/aspnet-mvc-4-adfs-20-and-3rd-party-sts.html

The first one uses ASP.NET Web Forms, while the second one uses ASP.NET MVC4. 第一个使用ASP.NET Web窗体,而第二个使用ASP.NET MVC4。

If your requirements allow you to use a third-party solution, also consider OpenID. 如果您的要求允许您使用第三方解决方案,请考虑使用OpenID。 There's an open source library called DotNetOpenAuth. 有一个名为DotNetOpenAuth的开源库。

For further information, read MSDN blog post Integrate OpenAuth/OpenID with your existing ASP.NET application using Universal Providers. 有关更多信息,请阅读MSDN博客文章使用Universal Providers将OpenAuth / OpenID与您现有的ASP.NET应用程序集成。

Hope this helps! 希望这可以帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM