title: How to encode a URL in jQuery/JavaScript and decode in ASP.NET
body: <p>How do you safely encode a URL using JavaScript such that it can be put into a GET string?</p>
  
  <p>Here is what I am doing in jQuery:</p>
  
  <pre><code>var url = "mynewpage.aspx?id=1234";
  $(location).attr('href', url);
  </code></pre>
  
  <p>And in the ASP.NET page_load, I am reading this:</p>
  
  <pre><code>_string _id = Request.QueryString["id"].ToString();
  </code></pre>
  
  <p>How can I encode the id in jQuery/JavaScript and decode in ASP.NET (C#)?</p>