开发者

ASP.NET System.Web.Routing and Querystring Parameters

开发者 https://www.devze.com 2022-12-21 14:13 出处:网络
I am using ASP.Net 3.5 SP1 \"System.Web.Routing\" to enable URL routing in my WebForm Application. Now what i needed is to pass some parameters in QueryString eg:

I am using ASP.Net 3.5 SP1 "System.Web.Routing" to enable URL routing in my WebForm Application. Now what i needed is to pass some parameters in QueryString eg:

http://www.mydomain.com/Search/Books/Computers?sort=author&pagesize=10

This is the route i am using:

        routes.Add("BooksSearch", new Route
        (
           "Search/{Category}/{Product}",
           new CustomRouteHandler("~/Search.aspx")
        ));
开发者_C百科

Route is working fine as it is redirected to search.aspx but in querystring i can't find extra parameters sort & pagesize.


Please Use

Page.RouteData.Values["ID"]

instead of

Request.QueryString["ID"]

Thanks


You do not have to add them to your route, as they will be processed normally.

The parameters are inside your Request.Params collection and inside tyour Request.QueryString collection.

0

精彩评论

暂无评论...
验证码 换一张
取 消