Redirect Script

Discussion in 'ASP.NET / ASP.NET Core' started by design4bbco, Mar 11, 2003.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Per our e-mail message, could you post a script to redirect visitors from our new URL to our old wesite address?

    Thanks
     
  2. Bruce

    Bruce DiscountASP.NET Staff

    1) Create a file named global.asax and save it in your root directory

    Put the following content in it (update the URL)

    <%@ Application language="VB" %>

    <script runat="server">

    Sub Application_Start(Sender As Object, E As EventArgs)
    ' Code that runs on application startup
    End Sub

    Sub Application_End(Sender As Object, E As EventArgs)
    ' Code that runs on application shutdown
    End Sub

    Sub Application_Error(Sender As Object, E As EventArgs)
    ' Code that runs when an unhandled error occurs
    End Sub

    Sub Session_Start(Sender As Object, E As EventArgs)
    ' Code that runs when a new session is started
    response.redirect("http://www.google.com")
    End Sub

    Sub Session_End(Sender As Object, E As EventArgs)
    ' Code that runs when a session ends
    End Sub

    </script>

    2) Leave index.aspx (already in your directory) in your root directory.

    Hope this helps

    quote:Originally posted by design4bbco

    Per our e-mail message, could you post a script to redirect visitors from our new URL to our old wesite address?

    Thanks
    </blockquote id="quote"></font id="quote">
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page