View Full Version : Request.UrlReferrer.ToString()

Aug 31st, 2005, 10:56 PM
I'm trying to use the Request.UrlReferrer.ToString() to get the referrer. It works but if you go straight to the page, meaning Request.UrlReferrer.ToString() is nothing, I get an Object instance not set to an instance of an object error. I tried..

If Not IsPostBack Then
If Not Request.UrlReferrer.ToString() Is Nothing Then
referrer = Request.UrlReferrer.ToString()
End If
End If

I still got the same error. Any ideas?

Aug 31st, 2005, 11:21 PM
I got it, I need to get rid of the .tostring() part. Thanks anyway ;)

Sep 3rd, 2005, 08:01 AM
in C#,you can:

if ( Request.UrlReferrer != null )
//do something here....

Sep 13th, 2005, 11:53 PM
thanks for the advice