title: how to logout the user from my asp.net application?
body: <p>I'm using custom code to login and logout the user in my web application. on click of the <em>login</em> button, the code below executes:</p>
  
  <pre><code>if (Membership.ValidateUser(txtUserEmail.Text, txtUserPass.Text))
  {
      HttpContext.Current.Profile.Initialize(txtUserEmail.Text.Trim(), true);
  }
  </code></pre>
  
  <p>I then check the profile.Username on pre-init of everypage to check whether the user is logged in or not. But now I don't know what to do to logout the user, so that the profile is set to null or something. I'm trying all of these on the click of the <em>logout</em> button : </p>
  
  <pre><code>protected void lnkBtnLogout_Click(object sender, EventArgs e)
  {
  Session.Abandon();
  Request.Cookies.Clear();
  FormsAuthentication.SignOut();
  var p = HttpContext.Current.Profile;
  Response.Redirect("/Default.aspx");
  }
  </code></pre>
  
  <p>I'm using variable p just to check whether the profile has been reset or not, but it still has all the values of the logged in user. So, what should I do to reset the profile and logout the user???</p>