title: How to use window.location.replace javascript?
body: <p>My URLs</p>
  
  <pre><code>http://www.mysite.com/folder1/page1.aspx
  http://www.mysite.com/folder1/page1.aspx?id=1
  http://www.mysite.com/folder1/page1.aspx?id=1&amp;dt=20111128
  </code></pre>
  
  <p>Redirecting Page</p>
  
  <pre><code>http://www.mysite.com/folder1/page2.aspx
  </code></pre>
  
  <p>I want to redirect from <code>page1.aspx</code> to <code>page2.aspx</code></p>
  
  <p>How to write a javascript in <code>page1.aspx</code>?</p>
  
  <pre><code>window.location.replace("/page2.aspx");
  window.location.replace("../page2.aspx");
  window.location.replace("~/page2.aspx");
  </code></pre>
  
  <p>First 2 gave me this.</p>
  
  <pre><code>http://www.mysite.com/page2.aspx
  </code></pre>
  
  <p>Last 1 gave me this.</p>
  
  <pre><code>http://www.mysite.com/folder1/~/page2.aspx
  </code></pre>
  
  <p>What is the correct way to use?</p>