How can I make my Context.User.Identity.Name equal to empty string after the user log-out. Because every time I go to Login Page the Context.User.Identity.Name is not empty. Thus, redirecting the user to the default page even though he already logged in.
My Log-Out code contains the following that I've researched but still doesn't make the Context.User.Identity.Name empty:
Session.Abandon();
HttpContext.Current.User =
new GenericPrincipal(new GenericIdentity(string.Empty), null);
FormsAuthentication.SignOut();
Response.Cookies[FormsAuthentication.FormsCookieName].Expires = DateTime.Now.AddYears(-1);`
While my login code contains:
if (Context.User.Identity.IsAuthenticated)
{
Response.Redirect("~/Default.aspx", false);
}