【发布时间】:2022-08-02 20:51:34
【问题描述】:
应用程序注销后,后退按钮单击会将用户重定向回应用程序的主屏幕. 我们如何阻止从 Azure 广告注销屏幕重定向到主屏幕?
- 应用程序:.NET MVC 5
- 框架:4.6.1
请在下面找到退出功能:
public void SignOut()
{
HttpContext.GetOwinContext().Authentication.SignOut(OpenIdConnectAuthenticationDefaults.AuthenticationType, CookieAuthenticationDefaults.AuthenticationType);
if (Request.Cookies[\"MyCookie\"] != null)
{
var c = new HttpCookie(\"MyCookie\");
c.Expires = DateTime.Now.AddDays(-1);
Response.Cookies.Add(c);
}
if (HttpContext.Request.Cookies[\".AspNet.ApplicationCookie\"] != null)
{
var c = new HttpCookie(\".AspNet.ApplicationCookie\");
c.Expires = DateTime.Now.AddDays(-1);
Response.Cookies.Add(c);
}
if (HttpContext.Request.Cookies[\"__RequestVerificationToken\"] != null)
{
var c = new HttpCookie(\"__RequestVerificationToken\");
c.Expires = DateTime.Now.AddDays(-1);
Response.Cookies.Add(c);
}
EndSession();
Session.Abandon();
AppSession.Clear();
}
public void EndSession()
{
Request.GetOwinContext().Authentication.SignOut();
Request.GetOwinContext().Authentication.SignOut(Microsoft.AspNet.Identity.DefaultAuthenticationTypes.ApplicationCookie);
this.HttpContext.GetOwinContext().Authentication.SignOut(CookieAuthenticationDefaults.AuthenticationType);
}
标签: azure azure-active-directory owin openid