Page.GetRouteUrl("routename", new { blah = "blah" })
Returns null
Response.RedirectToRoute("routename", new { blah = "blah" })
throws InvalidOperationException("No matching route found for Redirec开发者_StackOverflow中文版tToRoute.")
I put a breakpoint and checked System.Web.Routing.RouteTable.Routes
and my routes are there. I can use them without a hitch in my page code. What's the deal?
Check your route restrictions. I ran into the same problem before and it turned out that my route restrictions were incorrect.
Hope that helsps
Try:
Response.Redirect(string.Format("~/Blah.aspx/{0}", blah.ToString()));
Instead of:
Response.RedirectToRoute("routename", new { blah = "blah" })
精彩评论