I have a page signup.aspx where user can register, how this page will find from which page request came from and how it will red开发者_StackOverflowirect user after registration to the requesting page. I want to do this using query string but don't know how
On any links to the register page put
<a href="Signup.aspx?ReturnUrl=<%=Request.Url.AbsolutePath%>">Register Here</a>
then on your register form when they have registered add:
if (!String.IsNullOrEmpty(Request["ReturnUrl"]))
Response.Redirect(Request["ReturnUrl"]);
else
Response.Redirect("~/Default.aspx");
if(Request.QueryString["foo"] == "bar"){
Response.Redirect("page.php", true);
}
This would get the information from http://www.example.com/registered.aspx?foo=bar
So Request.QueryString["QueryString"] is the value of anything after the ? and each variable after the &. so if you had http://www.example.com/registered.aspx?foo=bar&abc=def
Then you would have 2 querystrings, foo and abc.
精彩评论