Is it possible to use routing and query strings together?
An example would be the following as a route in my Global.asax file:
void RegisterRoutes(System.Web.Routing.RouteCollection routes)
{
routes.MapPageRoute("My Route Name", "users/{UserName}", "~/users/UserInfo.aspx");
}
Could I somehow use http://www.mywebsite.com/users/usernamehere?info=bla and pass info=bla to the page? I would rather not try to encode this in the route schema.
Of course you can use routes and query string values together. When you define a route, your route is not determined by the query string; rather, it’s determined by your URL parts.
Check out this concise article about using routes and query strings — Sanderson points out that you can easily use the two together.
And even though the referenced article is about MVC2, you can use routing with ASP.NET web forms. I’ve used it before and it’s not too hard to implement.