Check For Key in Querystring in MappedUrl


/ Published in: C#
Save to your folder(s)

Check for a key in a querystring on a mappedUrl. ie: Will find a key in a querystring when appended to a friendly Url.


Copy this code and paste it in your HTML
  1. if (Request.RawUrl.Contains("keyid")) {
  2. var qstring = Request.RawUrl.Substring(Request.RawUrl.IndexOf("?") + 1, Request.RawUrl.Length - Request.RawUrl.IndexOf("?") - 1);
  3.  
  4. NameValueCollection query = HttpUtility.ParseQueryString(qstring);
  5. var keyId = query["keyid"];
  6.  
  7. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.