Request.UrlReferrer null?

UrlReferrer is based off the HTTP_REFERER header that a browser should send. But, as with all things left up to the client, it’s variable.

I know some “security” suites (like Norton’s Internet Security) will strip that header, in the belief that it aids tracking user behavior. Also, I’m sure there’s some Firefox extensions to do the same thing.

Bottom line is that you shouldn’t trust it. Just append the url to the GET string and redirect based off that.

UPDATE: As mentioned in the comments, it is probably a good idea to restrict the redirect from the GET parameter to only work for domain-less relative links, refuse directory patterns (../), etc. So still sanity check the redirect; if you follow the standard “don’t use any user-supplied input blindly” rule you should be safe.

Leave a Comment