I have a simple task without a simple solution.
I have a parameter in the browser that needs to be changed or rewritten
for instance http://www.contoso.com/countries.aspx?country=UK
all I need is to rewrite the parameter without checking the url so it might appear as:
http://www.contoso.com/countries.aspx?country=France
I have tried something like that but with no joy
string parameter2 = Request.QueryString["country"];
Context.RewritePath(parameter2.Replace("?country=", "France"));
You could do something like this:
var url = "www.contoso.com/countries.aspx?country={0}";var country = "UK";url = String.Format(url, country);Alternatively you can do:
var url = Request.Url.AbsolutePath;var country = Request.QueryString["country"];url = url.Replace(country, "UK");Then:
Response.Redirect(url);