title: asp.net web page pass parameter to another page include "#"
body: <p>I use vs2010. c#
  I need pass parameter from one page to another, it seems it's easy.
  however I have a issue ,the new page cannot get the parameter value.
  because of <strong>"#"</strong></p>
  
  <p>here is the sample</p>
  
  <p><strong>this is page 1</strong></p>
  
  <pre><code>&lt;body&gt;
  &lt;form id="form1" runat="server"&gt;
  &lt;div&gt;
  &lt;a href="WebForm2.aspx?item='#004'"&gt;go to webForm2&lt;/a&gt;
  &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p></p>
  
  <p><strong>the page2</strong></p>
  
  <pre><code> public partial class WebForm2 : System.Web.UI.Page
  {
      protected void Page_Load(object sender, EventArgs e)
      {
          string item = Request.QueryString["item"];
          //here item value is empty.
      }
  }
  </code></pre>
  
  <p>How to pass parameter with special character?</p>
  
  <p>I find the encodeURIComponent can sovle the problem, but it seems don't need to decode in c# code.
  here is the sample</p>
  
  <p><strong>Page1:</strong></p>
  
  <pre><code> &lt;script type="text/javascript"&gt;
      function goto() {
          var id = '#004@$%^&amp;?';
          var url = 'WebForm2.aspx?item=' + encodeURIComponent(id);
          window.location.href = url;
      }
  &lt;/script&gt;
  </code></pre>
  
  <p><strong>Page2</strong></p>
  
  <pre><code>    public partial class WebForm2 : System.Web.UI.Page
  {
      protected void Page_Load(object sender, EventArgs e)
      {
          string item = Request.QueryString["item"];
          Label1.Text = "pass value:" + item;
          //below the result is the same as above
          string value = Server.UrlDecode(item);
          Label2.Text = value;
      }
  }
  </code></pre>
  
  <p>Here no need to decode.</p>
  
  <p>Is that corrent?</p>