I want remove "Language" querystring from my url. How can i do this ? (using Asp.net 3.5 , c#)
I want to remove "Language=2", but language would be the first,middle or last. so i will have this
I answered a similar question a while ago. Basically, the best way would be to use the class
HttpValueCollection, which the
QueryString property actually is, unfortunately it is internal in the .NET framework.
You could use Reflector to grab it (and place it into your Utils class). This way you could manipulate the query string like a NameValueCollection, but with all the url encoding/decoding issues taken care for you.
NameValueCollection, and has a constructor that takes an encoded query string (ampersands and question marks included), and it overrides a
ToString() method to later rebuild the query string from the underlying collection.
If it's the HttpRequest.QueryString then you can copy the collection into a writable collection and have your way with it.
NameValueCollection filtered = new NameValueCollection(request.QueryString); filtered.Remove("Language");