Basically,What I want is when user click on the logout button, I want to close current browser tab from codebehind. code that I have tried
protected void LoginStatus1_LoggedOut(object sender, EventArgs e)
{
FormsAuthentication.SignOut();
Response.RedirectToRoutePermanent("logout");
}
Now let me show you that logout page which matched with route value:
logout.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
if (Request.Cookies["_underid"].Value != "15")
{
ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "alert01", "closeTab();", false);
}
Request.Cookies.Clear();
Response.Cookies.Clear();
Session.Abandon();
}
logout.aspx
function closeTab() {
debugger;
//window.close();
window.open(location, '_self').close();
}
But still not able to close browser window/current tab..
Its showing this,