eWebProgrammer
prev next prev next
  Course navigation
 
Lesson 10
Objective
Response.Redirect
Redirect a user to a different Web page.
   
Response.Redirect allows you to easily redirect a user to a different URL.
This is often very useful when customizing your site for different types of users.
As an example, you might be using frames in your ASP script, but a certain browser version may not support frames. In a case like this, you want to display a non-frames version of the same page to the user. This can be easily accomplished using Response.Redirect and the Browser Capabilities component or third-party component that allows you to interpret the header information to determine the type and version of browser that is communicating with your Web site.
Here is a code segment that makes the decision and directs the user to one of two alternate Web pages:
     Set objBCap = Server.CreateObject("MSWC.BrowserType")
     If objBCap.frames then
          Response.Redirect("frames.asp")
     Else
          Response.Redirect("noframes.asp")
     End if

Response.Redirect statement must be inserted in your ASP script before the tag. Otherwise you will receive an error stating that the HTTP header information has already been written out.

In the next lesson, you will use the Request and Response objects in your course project.
  Course navigation