Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Aug 2005
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Request.UrlReferrer.ToString()

    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..


    Code:
            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?

  • #2
    New Coder
    Join Date
    Aug 2005
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I got it, I need to get rid of the .tostring() part. Thanks anyway

  • #3
    New to the CF scene
    Join Date
    Sep 2005
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up

    in C#,you can:

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

  • #4
    New Coder
    Join Date
    Aug 2005
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks for the advice


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •