开发者

get parameters from referrer

开发者 https://www.devze.com 2023-03-20 08:36 出处:网络
Is there any easy way to extract the parameters of the referrer url as contained in Request.UrlReferrer? Is there another way to get the parameters use开发者_StackOverflow社区d by the referrer?

Is there any easy way to extract the parameters of the referrer url as contained in Request.UrlReferrer? Is there another way to get the parameters use开发者_StackOverflow社区d by the referrer?

Query?blahID=3&name=blah

I am refering to getting blahID and name from the url. It can be done with a bunch of string manipulations, but was hoping there was an easier way.


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"];
}
0

精彩评论

暂无评论...
验证码 换一张
取 消