Home Page

Click here to download the source code for this lesson.

While developing in ASP.NET, a lot of functionality can be implemented using a single web form, but there are scenarios where multiple web forms are necessary.  A common example of this on the web is order forms on shopping web sites.  Order forms can typically be comprised of several web pages, each page requests different information from the user about the purchase.  One page may request shipping information, whereas another web page may request credit card information.

Normally when you add a Button control to an ASP.NET web form and create the Click event, the Button will postback to the same web form when it is clicked.  But suppose you want to bring up another web form when the Button is clicked.  You can accomplish this by using a redirect.  A redirect simply means you are sending a message to the browser, telling it to visit a different web page.

ASP.NET gives you access to a special object called the Response object.  The Response object contains a method called Redirect that you can use to perform the redirection to another web page.  You should pass the name of the web page to the Redirect method as a string parameter.


Click here to watch an example video where I redirect from Page1.aspx to Page2.aspx

1 Comment »

  1. This is good stuff

    Comment by Lee Griffith — December 30, 2008 @ 3:02 pm

RSS feed for comments on this post. TrackBack URL

Leave a comment

Comments are moderated for spam protection. Please do not submit your comment twice -- it will appear shortly.