I’ve had several cases where I had a page with several query parameters – most recently a search results page – and needed to create a link to the same page with one or more query parameters changed in the URL. This seems like such a common use case that I feel as though there must be some simple built-in way of doing it.
Right now, I’m using a function I wrote which takes in a dictionary of parameters and values and merges them with the params and values from Request.QueryString. Parameters given with a null value are removed. It works, but I’m open to simpler methods.
Minor improvements I’d suggest:
Edit
Actually the return value should also be a
Uritype but I didn’t want to introduce any breaking changes.