code_junkie

How do you use querystrings with ASP.NET routing?

Nov 11th, 2011
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. Search(string term, int page)
  2.  
  3. MapPageRoute("myroute", "myroute/{x}", "~/routehander.aspx")
  4.  
  5. http://mywebsite.com/myroute/{x}?url=myurl
  6.  
  7. Dim x as integer = 12
  8. Dim rvd As New Routing.RouteValueDictionary
  9. rvd.Add("x", x)
  10. rvd.Add("url", Server.UrlEncode("/default.aspx"))
  11. HttpContext.Current.ApplicationInstance.Response.RedirectToRoutePermanent("myroute", rvd)
  12.  
  13. http://mywebsite.com/myroute/12?url=%252fdefault.aspx
Add Comment
Please, Sign In to add comment