1

1

What's the best way to redirect a webpage? I'm using asp.net

flag

3 Answers

2

This depends on what you are looking to do.

If you want to redirect to a local page without displaying the NEW page's name in the url string, you can use

Server.Transfer("~/mynewpage.aspx")

If you want to just to simply transfer them to a new page you can use

Response.Redirect("~/mynewpage.aspx")

However if you need to do a permanent redirect... similar to what url shorteners use, you'll want to be a bit more advanced...

Response.Stats = "301 Moved Permanently"
Response.AddHeader("Location", "http://www.mynewsite.com/mynewpage.aspx")
link|flag
this is really informative! You helped me a lot thanks! – cssnoobie Oct 13 at 18:33
2

response.redirect("http://ww.google.com");

link|flag
1

For very very simple, static redirections, there's always the

<meta http-equiv="REFRESH"...>

tag in the <head> section of the HTML document. This page has an example.

link|flag

Your Answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.