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"];
}
精彩评论