title: Prevent page reload when setting session variable
body: <p>I have an asp button, and on the click event a session variable is set and the page is redirected. The problem is that this process requires two clicks - once to set the session and another to redirect. How can I set the session and redirect in one click? My code is as follows:</p>
  
  <pre><code>protected void btn_login_Click(object sender, EventArgs e)
  {
         HttpContext.Current.RewritePath("AnotherPage.aspx");
         Session.Add("user-id", _id);
  }
  </code></pre>