title: ASP.NET MVC - Create action link preserve query string
body: <p>I am currently writing my own paged list for ASP.NET Core MVC.</p>
  
  <p>I struggle while creating the following:</p>
  
  <p>I want to create a UrlHelper extension method:
  Url.PageLink(int page, int pageSize)</p>
  
  <p>Within that extension method I want to return a link which reuses ALL current values for controller, action, querystring and in addition it should add/update the page, pageSize values in the querystring as well.</p>
  
  <p>Questions:
  From where do I get the current controller and action in the UrlHelper object?
  What is the best way to rebuild the querystring?
  I can see it here url.ActionContext.HttpContext.Request.QueryString... but do I really have to manually rebuild it? Or does something like AddQueryStringValue(int key, object value) exist?</p>
  
  <p>Thanks so much in advance!!!
  Simon</p>