how to really logout in asp.net

mirza picture mirza · Oct 29, 2013 · Viewed 39.8k times · Source

I use LoginControl for login into my website in asp.net, but when for logout use login status or session.Abandon or .sign out ,there's white backspace, my homepage is loaded and its not secure.

Please help me that use realy logout in my project.

Answer

Habibillah picture Habibillah · Oct 29, 2013

use FormsAuthentication.SignOut(); as below:

protected void LogoutButton_Click(object sender, EventArgs e)
{
    FormsAuthentication.SignOut();
    Response.Redirect("~/Login.aspx");
}