By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,851 Members | 983 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,851 IT Pros & Developers. It's quick & easy.

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

P: n/a
..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?

--
Elliot M. Rodriguez, MCSD

My .Net thoughts, comments, observations:
http://derivedclass.europe.webmatrixhosting.net
Nov 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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)
"Elliot M. Rodriguez" <someemail> wrote in message
news:OL**************@TK2MSFTNGP09.phx.gbl...
.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?

--
Elliot M. Rodriguez, MCSD

My .Net thoughts, comments, observations:
http://derivedclass.europe.webmatrixhosting.net

Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.