PDA

View Full Version : Request.UrlReferrer.ToString()



flann
08-31-2005, 09: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?

flann
08-31-2005, 10:21 PM
I got it, I need to get rid of the .tostring() part. Thanks anyway ;)

ceocio
09-03-2005, 07:01 AM
in C#,you can:

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

flann
09-13-2005, 10:53 PM
thanks for the advice