Redirecting users from one page to the other
I have a page which gets all i开发者_如何学Pythonts data from the database
www.mysite.com/List/Oct/DisplayPost.aspx?id=120
Now I want to redirect this page to
www.mysite.com/List/Oct/DisplayPost.aspx?id=150
Is that possible. What are the different ways to do it? Any easy way out?
[Update]: It's a Master/Content page scenario. More there is only one page called DisplayPost.aspx (like a template page)..the DisplayPost.aspx?id=x gets generated dynamically taking data from the database.
Your options are Response.Redirect or Server.Transfer (aside from a client redirect using Javascript). See this post for a discussion of Server.Transfer.
Response.Redirect("~/DisplayPost.aspx?id=150")
Take a look at ASP Redirect Method and please always take a look at W3 first. ;) Do like this:
<%
Response.Redirect "www.mysite.com/List/Oct/DisplayPost.aspx?id=150"
%>
Sounds like you have a permanent redirect, have you considered a permanent 301 redirect for that specific URL?
EDIT: When I say specific URL I mean, ww.mysite.com/List/Oct/DisplayPost.aspx?id=120.
精彩评论