title: How to update querystring in C#?
body: <p>Somewhere in the url there is a &amp;sortBy=6 . How do I update this to &amp;sortBy=4 or &amp;sortBy=2 on a button click? Do I need to write custom string functions to create the correct redirect url?</p>
  
  <p>If I just need to append a query string variable I would do</p>
  
  <pre><code>string completeUrl = HttpContext.Current.Request.Url.AbsoluteUri + "&amp;" + ...
  Response.Redirect(completeUrl);
  </code></pre>
  
  <p>But what I want to do is modify an existing querystring variable. </p>