2

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")
        ));

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

1
  • i am still unable to find a way to get it working.. any pointers????? Commented Mar 2, 2010 at 6:32

2 Answers 2

3

Please Use

Page.RouteData.Values["ID"]

instead of

Request.QueryString["ID"]

Thanks

Sign up to request clarification or add additional context in comments.

Comments

2

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.

2 Comments

Request.Params["sort"] and Request.QueryString["sort"] both returns null. I think that is because CustomRouteHandler initialize target page dynamically without any QueryString params.
From your acceptance I take it that you have found your missing parameters.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.