Error in IE

  • Thread starter Thread starter pmelanso
  • Start date Start date
P

pmelanso

Hello,
I get an Object reference not set to an instance of an object error
when I try to run my web app in IE for this line:

Dim UrlRef As String = Request.UrlReferrer.ToString().

But when i run it in FoxFire I don't get the error. Does anybody know
why???
 
This isn't a browser error since the code you are talking about isn't
processed on the client, it is processed on the server.

Having said that, Object Reference Not Set To An Instance Of An Object means
that what you are trying to retireve isn't returning any object. There are
times when there is no referrer (like when someone goes directly to your
page without having clicked a link from some other page). In those cases,
Request.UrlReferrer.ToString() will return nothing.

Also, There is a privacy protection mechanism in some firewalls that blocks
sending the URL Referrer. If the firewall blocks the referrer, it makes
sense the code crashes.

You should/could be checking Request.UrlReferrer.ToString() to see if it
returns a value before attempting to use it:

Dim UrlRef As String
If Not IsDBNull(Request.UrlReferrer.ToString()) Then UrlRef =
Request.UrlReferrer.ToString()


-Scott
 

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

Back
Top