Webblocking software and using Request.ServerVariables("HTTP_REFERER")

  • Thread starter Elliot M. Rodriguez
  • Start date
E

Elliot M. Rodriguez

..NET Framework 1.1

Has anyone reported or experienced NullReferenceException errors when
accessing the HTTP_REFERER value on clients that are behind web blocking
software?

At least one of our customers uses the WatchDog WebBlocker product. Our web
app would throw NullReferenceException errors on the following line
(assigning a Hyperlink control's NavigateURL property to the HTTP_REFERER
value):

lnk.NavigateUrl = Request.ServerVariables("HTTP_REFERER").ToString();

And return the error message:
"Object reference not set to an instance of an object"

Which leads me to wonder if the blocking software is also blocking
ServerVariables in the entire HTTP request .

I ended up having to use a Javascript line
("javascript:window.history.back(-1)") to work around this.

Can anyone else contribute their experiences?
 
B

bruce barker

HTTP_REFERER returns the header value sent by the browser in the request.
Null means the header was not present. Browsers do not have to send it, and
it makes sense to strip it for security . Never have your site depend on
this header being sent.

-- bruce (sqlwork)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top