Question: I know i can do this

```
var nv = HttpUtility.ParseQueryString(req.RawUrl);

```

But is there a way to convert this back to a url?

```
var newUrl = HttpUtility.Something("/page", nv);

```

Answer: 
Simply calling `ToString()` on the `NameValueCollection` will return the name value pairs in a `name1=value1&name2=value2` querystring ready format. Note that `NameValueCollection` types don't actually support this and it's misleading to suggest this, but the behavior works here due to the internal type that's actually returned, as explained below.

Thanks to @mjwills for pointing out that the `HttpUtility.ParseQueryString` method actually returns an internal `HttpValueCollection` object rather than a regular `NameValueCollection` ([despite the documentation specifying `NameValueCollection`](http://msdn.microsoft.com/en-us/library/ms150046(v=vs.110).aspx)). The `HttpValueCollection` automatically encodes the querystring when using `ToString()`, so there's no need to write a routine that loops through the collection and uses the `UrlEncode` method. The desired result is already returned.

With the result in hand, you can then append it to the URL and redirect:

```
var nameValues = HttpUtility.ParseQueryString(Request.QueryString.ToString());
string url = Request.Url.AbsolutePath + "?" + nameValues.ToString();
Response.Redirect(url);

```

Currently the only way to use a `HttpValueCollection` is by using the `ParseQueryString` method shown above (other than reflection, of course). It looks like this won't change since the [Connect issue requesting this class be made public](https://connect.microsoft.com/VisualStudio/feedback/details/356144/make-the-httpvaluecollection-class-public-and-move-it-to-system-dll) has been closed with a status of "won't fix." 

As an aside, you can call the `Add`, `Set`, and `Remove` methods on `nameValues` to modify any of the querystring items before appending it. If you're interested in that [see my response to another question](https://stackoverflow.com/questions/3813934/change-single-url-query-string-value/3814281#3814281).
```
string q = String.Join("&",
             nvc.AllKeys.Select(a => a + "=" + HttpUtility.UrlEncode(nvc[a])));

```