Get parameters from the referrer

Is there an easy way to retrieve the parameters of the referrer URL contained in Request.UrlReferrer? Is there any other way to get the parameters used by the referrer?

Request blahID = 3 &? Name = blah

I mean getting the blahID and name from the URL. This can be done with a bunch of line manipulations, but hoped there was an easier way.

+6
source share
1 answer

Use HttpUtility.ParseQueryString from System.Web . Something like this should work:

 string blahID = string.Empty; if(Request.UrlReferrer != null) { var q = HttpUtility.ParseQueryString(Request.UrlReferrer.Query); blahID = q["blahID"]; } 
+16
source

Source: https://habr.com/ru/post/892831/


All Articles