title: How to track http referrer across post back?
body: <p>I have a page in my website that can be reached from several other pages.  On this page I have a cancel button and when people click that I would like to execute some code on the server and then redirect back to the page they came from.</p>
  
  <p>I was trying to do this by referencing Request.UrlReferrer, but once a post back occurs, this is set to the current page.</p>
  
  <p>I have come up with a workaround using session state:</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
      if (!Page.IsPostBack)
      {
            Session["referrer"] = Request.UrlReferrer.AbsoluteUri;
      }
  }
  
  btn_Cancel_click(object sender, EventArgs e)
  {
      //Some other code and then the line below:
      Response.Redirect(Session["referrer"]);
  }
  </code></pre>
  
  <p>But I'm curious if there is a more graceful way to do this without using session state.  Can anyone suggest a better solution for this?</p>