title: ASP.NET - Response.Redirect Not Populating Url Referrer
body: <p>I feel like i've done this a ton of times, but i can't for the life of me figure out what is going wrong.</p>
  
  <p><strong>Default.aspx:</strong></p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
     var r1 = Request.UrlReferrer; // null
     var r2 = Request.ServerVariables["HTTP_REFERRER"]; // null
  }
  </code></pre>
  
  <p><strong>SingleSignOn.aspx:</strong></p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
     Response.Redirect("/");
  }
  </code></pre>
  
  <p>If i type "/SingleSignOn.aspx" in the URL, it redirects to Default.aspx, but the referrer is null.</p>
  
  <p>What am i missing here?</p>
  
  <p>What im trying to do (this is a simplified example), is on any page, i will have some JavaScript to do the following:</p>
  
  <pre><code>window.location.replace('~/SingleSignOn.aspx');
  </code></pre>
  
  <p>Which, you guessed it, signs the user in, and redirects to the homepage.</p>
  
  <p>But i need to build logic into that JavaScript to not redirect to the SingleSignOn.aspx page if we just came from there.</p>
  
  <p>Does the referrer only get populated by actual link user clicks?</p>
  
  <p>How can i do this then? I don't want to use QueryString because i dont want to see that in the URL.</p>
  
  <p>The only other option i can think of is Session. </p>
  
  <p>Please help. =(</p>