code_junkie

Best way to add a key/value to an existing URL string

Nov 14th, 2011
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.13 KB | None | 0 0
  1. string url = Request.UrlReferrer.PathAndQuery;
  2.  
  3. (url[url.Length - 1] != '?' ? "?" : "&") + Url.Encode(key) + "=" + Url.Encode(key)
Add Comment
Please, Sign In to add comment