Using Aspnet Components

You can create a page that accepts a page name from the QueryString and redirects the user to that page.

TYPE THIS:

<% @ PAGE LANGUAGE="C#" Buffer="True"%>

if (Request.QueryString["pageName"] != null) {

string stringPageName = Request.QueryString["pageName"]

.ToString(); Response.Redirect(stringPageName);

Response.Redirect(Request.Url.ToString() + "?pageName=ie.aspx");

RESULT:

A request to this page with a query string equal to pageName=request.aspx will redirect the request to the request.aspx page. If the page is not specified, then you are redirected to ie.aspx.

E Click the Submit button.

_0 Create a switch statement using the string variable.

_• Add a case for each of the options that redirects to the appropriate page.

, Save the file and request from the Web server.

| Copy the files FewerGoals.aspx, MoreGoals.aspx, SameGoals.aspx, and ErrorGoals.aspx from the CD-ROM to your working directory.

■ The page with suggestions appears.

-E Click 0 and select a suggestion.

E Click the Submit button.

■ You are redirected to a page according to the option you have selected.

Was this article helpful?

0 0

Post a comment