Getting HTTP_REFERER value

Discussion in 'ASP .Net' started by John, Oct 6, 2004.

  1. John

    John Guest

    Hi

    I am trying to save the value of HTTP_REFERER so I can use it later on in
    the webform as below;

    Public Return_Address as string

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles MyBase.Load
    Return_Address = Request.ServerVariables("HTTP_REFERER")
    End Sub

    The problem is that Return_Address value always comes out blank. What am I
    doing wrong?

    Thanks

    Regards
    John, Oct 6, 2004
    #1
    1. Advertising

  2. Hi John,

    It will be empty the first time you open the page because there is no
    referrer. After clicking the hyperlink in the code below, you should see the
    value. Let us know how you make out?

    <%@ Page Language="VB" %>
    <script runat="server">

    ' Insert page code here
    '
    Public Return_Address as string

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles MyBase.Load
    Return_Address = Request.ServerVariables("HTTP_REFERER")
    End Sub

    </script>
    <html>
    <head>
    </head>
    <body>
    <form runat="server">
    <asp:HyperLink id="HyperLink1" runat="server"
    NavigateUrl="referrer.aspx">HyperLink</asp:HyperLink>
    <%= Return_Address%>
    </form>
    </body>
    </html>


    "John" wrote:

    > Hi
    >
    > I am trying to save the value of HTTP_REFERER so I can use it later on in
    > the webform as below;
    >
    > Public Return_Address as string
    >
    > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    > System.EventArgs) Handles MyBase.Load
    > Return_Address = Request.ServerVariables("HTTP_REFERER")
    > End Sub
    >
    > The problem is that Return_Address value always comes out blank. What am I
    > doing wrong?
    >
    > Thanks
    >
    > Regards
    >
    >
    >
    =?Utf-8?B?S2VuIENveCBbTWljcm9zb2Z0IE1WUF0=?=, Oct 6, 2004
    #2
    1. Advertising

  3. John

    Joe Guest

    In general, keep in mind the http version that is making the request. Http
    1.0 and http 1.1 requests will yield different results for certain server
    variables.


    "Ken Cox [Microsoft MVP]" <> wrote in message
    news:...
    > Hi John,
    >
    > It will be empty the first time you open the page because there is no
    > referrer. After clicking the hyperlink in the code below, you should see
    > the
    > value. Let us know how you make out?
    >
    > <%@ Page Language="VB" %>
    > <script runat="server">
    >
    > ' Insert page code here
    > '
    > Public Return_Address as string
    >
    > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    > System.EventArgs) Handles MyBase.Load
    > Return_Address = Request.ServerVariables("HTTP_REFERER")
    > End Sub
    >
    > </script>
    > <html>
    > <head>
    > </head>
    > <body>
    > <form runat="server">
    > <asp:HyperLink id="HyperLink1" runat="server"
    > NavigateUrl="referrer.aspx">HyperLink</asp:HyperLink>
    > <%= Return_Address%>
    > </form>
    > </body>
    > </html>
    >
    >
    > "John" wrote:
    >
    >> Hi
    >>
    >> I am trying to save the value of HTTP_REFERER so I can use it later on in
    >> the webform as below;
    >>
    >> Public Return_Address as string
    >>
    >> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    >> System.EventArgs) Handles MyBase.Load
    >> Return_Address = Request.ServerVariables("HTTP_REFERER")
    >> End Sub
    >>
    >> The problem is that Return_Address value always comes out blank. What am
    >> I
    >> doing wrong?
    >>
    >> Thanks
    >>
    >> Regards
    >>
    >>
    >>
    Joe, Oct 8, 2004
    #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. Elliot M. Rodriguez
    Replies:
    1
    Views:
    627
    bruce barker
    Feb 12, 2004
  2. SStory

    HTTP_REFERER blank

    SStory, Feb 27, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    2,369
    Eric Lawrence [MSFT]
    Feb 28, 2004
  3. =?Utf-8?B?cHBhdGVs?=

    Request.ServerVariables ("HTTP_REFERER") using https

    =?Utf-8?B?cHBhdGVs?=, Mar 2, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    3,524
    Eric Lawrence [MSFT]
    Mar 3, 2004
  4. Troy

    Hit redirection & HTTP_REFERER

    Troy, Jun 24, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    618
    Joerg Jooss
    Jun 26, 2004
  5. Johny

    HTTP_REFERER value

    Johny, Feb 17, 2007, in forum: Python
    Replies:
    3
    Views:
    1,089
    Johny
    Feb 17, 2007
Loading...

Share This Page