Where request came from/referrer

Discussion in 'ASP .Net' started by =?Utf-8?B?U2VnYQ==?=, Apr 11, 2006.

  1. I am trying to find where my user came from - in particular whether they came
    from our application login on our own site or whether they came by keying the
    url directly without going through our login.

    Currently I am using the following code, but would be happy to change to
    something more effective.
    Dim MyUrl As Uri = Request.UrlReferrer
    If MyUrl Is Nothing Then
    gvMyUrl = "nothing"
    Else
    gvMyUrl = MyUrl.ToString
    End If


    No matter how the user comes to my app I am getting "nothing". That is to
    be expected if keying the URL directly. When using the logon I am still
    getting nothing. Is that because it is coming from a secure site (the logon)
    to my app which is not on a secure site?

    Any ideas how to get this "where from" info.

    Thanks for any help I can get. I am desperate to solve this and not really
    experienced in this area.
     
    =?Utf-8?B?U2VnYQ==?=, Apr 11, 2006
    #1
    1. Advertising

  2. UrlRefer is filled in by the browser and optional. Many proxy servers will
    strip it for security reasons, I expect most browsers will all stop
    supporting it. if your want to know where in your site a link came from, add
    a url parameter to it.

    http://mysite/somepage.aspx?source=login


    -- bruce (sqlwork.com)







    "Sega" <> wrote in message
    news:...
    >I am trying to find where my user came from - in particular whether they
    >came
    > from our application login on our own site or whether they came by keying
    > the
    > url directly without going through our login.
    >
    > Currently I am using the following code, but would be happy to change to
    > something more effective.
    > Dim MyUrl As Uri = Request.UrlReferrer
    > If MyUrl Is Nothing Then
    > gvMyUrl = "nothing"
    > Else
    > gvMyUrl = MyUrl.ToString
    > End If
    >
    >
    > No matter how the user comes to my app I am getting "nothing". That is to
    > be expected if keying the URL directly. When using the logon I am still
    > getting nothing. Is that because it is coming from a secure site (the
    > logon)
    > to my app which is not on a secure site?
    >
    > Any ideas how to get this "where from" info.
    >
    > Thanks for any help I can get. I am desperate to solve this and not
    > really
    > experienced in this area.
    >
     
    bruce barker \(sqlwork.com\), Apr 11, 2006
    #2
    1. Advertising

  3. As you seem to already know, UrlReferrer will only work with requests that
    load in the same or another browser window invoked via a hyperlink.

    No UrlReferrer object is returned when loading pages into a window using
    client-side scripting methods.

    Also, corporate firewalls can interfere with the ability to get this
    information, as can various types of privacy and anti-virus / anti-malware
    software.

    If all you really need to know is whether somebody "got here" after logging
    into your secure site, why not either just put something on the querystring
    to your app that determines this or if it is the same application, set a
    session variable "LoggedIn" to true, or set a cookie after they have logged
    in and then read it when they arrive at your app?
    Peter


    --
    Co-founder, Eggheadcafe.com developer portal:
    http://www.eggheadcafe.com
    UnBlog:
    http://petesbloggerama.blogspot.com




    "Sega" wrote:

    > I am trying to find where my user came from - in particular whether they came
    > from our application login on our own site or whether they came by keying the
    > url directly without going through our login.
    >
    > Currently I am using the following code, but would be happy to change to
    > something more effective.
    > Dim MyUrl As Uri = Request.UrlReferrer
    > If MyUrl Is Nothing Then
    > gvMyUrl = "nothing"
    > Else
    > gvMyUrl = MyUrl.ToString
    > End If
    >
    >
    > No matter how the user comes to my app I am getting "nothing". That is to
    > be expected if keying the URL directly. When using the logon I am still
    > getting nothing. Is that because it is coming from a secure site (the logon)
    > to my app which is not on a secure site?
    >
    > Any ideas how to get this "where from" info.
    >
    > Thanks for any help I can get. I am desperate to solve this and not really
    > experienced in this area.
    >
     
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=, Apr 11, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. William Newsom
    Replies:
    1
    Views:
    380
    Ed Crowley
    Sep 24, 2003
  2. Wayne  Wengert

    Using Request.Referrer

    Wayne Wengert, Oct 2, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    10,422
    Wayne Wengert
    Oct 2, 2004
  3. =?Utf-8?B?U3RlcGhhbmU=?=

    Asp.net page request has not referrer?

    =?Utf-8?B?U3RlcGhhbmU=?=, Oct 21, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    6,511
    =?Utf-8?B?U3RlcGhhbmU=?=
    Oct 21, 2004
  4. =?Utf-8?B?SGVua2U=?=

    How to get the url where I came from?

    =?Utf-8?B?SGVua2U=?=, Jun 7, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    399
    Juan T. Llibre
    Jun 7, 2005
  5. Peter

    Go back where I came from

    Peter, Nov 11, 2005, in forum: ASP .Net
    Replies:
    6
    Views:
    578
    Steven Cheng[MSFT]
    Nov 14, 2005
Loading...

Share This Page