..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.netHTTP_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:OLgEp5X8DHA.2560@.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
Monday, March 12, 2012
Webblocking software and using Request.ServerVariables("HTTP_REFERER")
Labels:
1has,
asp,
clients,
errors,
experienced,
framework,
http_referer,
net,
nullreferenceexception,
reported,
requestservervariables,
software,
value,
webblocking,
whenaccessing
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment