HTTP_REFERER in asp.net 2.0

Last post 04-02-2008 5:41 AM by Zhao Ji Ma - MSFT. 1 replies.

Sort Posts:

  • HTTP_REFERER in asp.net 2.0

    03-31-2008, 10:56 AM
    • Member
      69 point Member
    • dotnet333
    • Member since 08-28-2007, 3:11 PM
    • Mumbai
    • Posts 40
    I want to redirect only from my server pages to Particular pages and not allowing to access directly form www.xyz.com/Page1.aspx to Page2 and not aloowing to access page directly in through browser address like www.xyz.com/Page2.aspx and enter ( not allowed) how can i done this in ASP.NET 2.0 ( earlier version i used to server variable to check whether request comes from within server or not with HTTP_REFERER)
  • Re: HTTP_REFERER in asp.net 2.0

    04-02-2008, 5:41 AM

    Hi,

    Use this example:

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            If Request.ServerVariables("HTTP_REFERER") <> www.xyz.com/Page1.aspx Then
                'redirect to error page
            Else
                'allow page to process
            End If

    End Sub 

    It is from: http://forums.asp.net/t/1240920.aspx

    Zhao Ji Ma
    Sincerely,
    Microsoft Online Community Support

    “Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. ”
Page 1 of 1 (2 items)