given is an URL like http://localhost:1973/Services.aspx?idProject=10&idService=14
.
What is the most straightforward way to replace both url-parameter values(for example 10 to 12 and 14 to 7)?
Regex, String.Replace, Substring or LinQ - i'm a little stuck.
Thank you in advance,
Tim
I ended with following, that's working for me because this page has only these two parameter:
string newUrl = url.Replace(url.Substring(url.IndexOf("Services.aspx?") + "Services.aspx?".Length), string.Format("idProject={0}&idService={1}", Services.IdProject, Services.IdService));
But thank you for your suggestions :)
Here is my implementation:
and here are some examples:
I found this in an old code example, wouldnt take much to improve it, taking a
IEnumerable<KeyValuePair<string,object>>
may be better than the current delimeted string.Usage