title: Passing URL parameters in code behind
body: <p>I need to pass parameters contains in the URL, when the user clicks a link.</p>
  
  <p><code>&lt;li&gt;&lt;a href='&lt;%# GetURLPath() %&gt;'&gt;&lt;font color="red"&gt;User link&lt;/font&gt;&lt;/a&gt;&lt;/li&gt;</code></p>
  
  <p>When my url looks like this,</p>
  
  <pre><code>http://localhost:1241/Home.aspx?userid=123&amp;username=prosper
  </code></pre>
  
  <p>My first try:</p>
  
  <pre><code>protected string GetURLPath()
   {
     return "/Request.aspx?UserID=" + Request.QueryString["userid"] + "&amp;UserName=" + Request.QueryString["username"];
   }
  </code></pre>
  
  <p>My second try,</p>
  
  <pre><code>string userid;
  string username;
  
  userid = (string)(Session["userid"]);
  username = (string)(Session["userid"]);
  
  return "Request.aspx?UserID=" + userid + "&amp;UserName=" + username;
  </code></pre>
  
  <p>The problem I'm having is, the intended page Request.apsx doesn't get loaded. On a side note, when I handled this issue in designer.cs the parameters won't get passed to the Request.apsx.</p>
  
  <p>Thanks!</p>