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 used 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.
Referrer parameters refer to where the person was previously and you can pull data into the form there too. The URL paramater is purely about the current page, and the referring paramater is about the previous page.
It's available in the HTTP referer header. You can get it in a servlet as follows: String referrer = request. getHeader("referer"); // Yes, with the legendary misspelling.
The address of the webpage where a person clicked a link that sent them to your page. The referrer is the webpage that sends visitors to your site using a link.
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"];
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With