简体   繁体   English

如何重定向到网站登出页面。

[英]How to re-direct to a page on website logout.?

First let me explain the scenario. 首先让我解释一下情况。

There are 2 websites, website-A and website-B. 有2个网站,网站A和网站B。 Both websites are hosted in different domains. 两个网站都托管在不同的域中。

  • User is able to login to website-B's homepage through website-A login page. 用户可以通过网站-A登录页面登录到网站-B的主页。 This means that the user is now in complete control of website-B's functionalities. 这意味着用户现在可以完全控制网站B的功能。

  • On successful logout in website-B, the user is re-directed to the homepage of website-B (which is the right behaviour). 在网站B中成功注销后,用户将被重定向到网站B的主页(这是正确的行为)。

My question starts here. 我的问题从这里开始。

Is there a possible way to ensure that the user is re-directed to website-A's login page on successful logout in website-B rather than re-directing to website-B's login page? 有没有一种方法可以确保在成功注销网站B后将用户重定向到网站A的登录页面,而不是重定向到网站B的登录页面?

If this is possible, then please do guide me on how to proceed in this scenario. 如果可能的话,请在这种情况下指导我如何进行。

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

你为什么不使用Response.Redirect("url");

If you are using forms authentication, you can create a logout method like : 如果您使用表单身份验证,则可以创建如下注销方法:

private void Logout()
{
  Session.Abandon();
  FormsAuthentication.SignOut();
  FormsAuthentication.RedirectToLoginPage();
}

FormsAuthentication.RedirectToLoginPage will redirect to the LoginUrl . FormsAuthentication.RedirectToLoginPage将重定向到LoginUrl

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

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