Remove a query string parameter from a URL
The problem with your design is that you assume the URL is actually well formed. In my experience (writing web crawlers) we found that greater than 80% of URL's on the web are badly formatted the biggest offender is the first ? that separates the attributes from the target (this was often a &amp;).

Now if you URL is badly formatted like this:

http://stackoverflow.com&amp;Country=US&amp;City=Seattle&amp;State=WA
                   //   ^ Notice the bad format


Your code will break that URL and turn it into:

http://stackoverflow.comUS&amp;City=Seattle&amp;State=WA


Probably not what you want.

Also URL as they pass through systems tend to be normalized (so they can be sorted and all sorts of other things). So your URL may have started of as the above but because it was normalized your query parameters have been re-ordered.

 http://stackoverflow.com?City=Seattle&amp;Country=US&amp;State=WA
                  // Query parameters ordered lexicographically.


Now if you just go and remove the attribute names they may not be in the order you expect.

Now imagine a well formatted URL but with another domain.

http://No.Country=US.For.Old.Men.com?Country=US&amp;City=Seattle&amp;State=WA


Which is a perfectly valid domain. But your code is going to strip out a segment for the domain (and thus make the URL invalid).

http://No..For.Old.Men.com?Country=US&amp;City=Seattle&amp;State=WA
     //  ^^ two dotes consecutively is not valid domain.


Your best bet is to get some already written software for handling URL's there are just too many corner cases for you to write and expect to handle the URL correctly.