我正在使用ASP.Net 3.5URL "System.Web.Routing“在我的WebForm应用程序中启用SP1路由。现在我需要的是在QueryString中传递一些参数,例如:
http://www.mydomain.com/Search/Books/Computers?sort=author&pagesize=10
这是我正在使用的路由:
routes.Add("BooksSearch", new Route
(
"Search/{Category}/{Product}",
new CustomRouteHandler("~/Search.aspx")
));路由工作正常,因为它被重定向到search.aspx,但是在查询字符串中,我找不到额外的参数排序和页面大小。
发布于 2010-02-26 20:57:56
您不必将它们添加到您的路由,因为它们将被正常处理。
参数在你的Request.Params集合和Request.QueryString集合中。
发布于 2011-11-15 20:49:00
请使用
Page.RouteData.Values"ID“
而不是
Request.QueryString"ID“
谢谢
https://stackoverflow.com/questions/2341639
复制相似问题