Redirecting a web user to another web page without requiring the user to click a link is a common practice in web development. The built in function of C# is the Redirect function. The redirection function can take one or two input parameters. With one input parameter, simply specify the redirect url.
Response.Redirect(”http://www.victorchen.info”);
By using only one parameter, code after the Redirect function can still be executed. To prevent this, use the overloaded Redirect function with two input parameters. The first input parameter is still the redirect url, but the second input is the a boolean variable indicating whether remaining code on the page should continue executing or stop when the redirection function is reached.
Response.Redirect(”http://www.victorchen.info”, false);
Redirect is a function of the HttpResponse class. The Redirect function returns void.
This entry was posted on Monday, March 31st, 2008 at 6:41 am and is filed under C#. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
[…] can take one or two input parameters. With one input parameter, simply specify the redirect url.read more | digg story Share and Enjoy: These icons link to social bookmarking sites where readers can […]
March 31st, 2008 at 1:32 pm