开发者

get parameters from 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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜