asp.net routing on homepage
When using routing (asp.net webforms) I want to setup a home route so I c开发者_运维百科an browse articles on the frontpage like this
domain.com domain.com/1 domain.com/2 domain.com/3
I have no idea how to setup this routing because ~/ isn't accepted in the route. I tried http://www.domain.com/home/1 which works fine but is less nice ofcourse.
When I do it like this it work's fine but not on the homepage because it's looking for a pageindex which is ofcourse 'Default.aspx':
routes.Add(
"Home",
new Route("{PageIndex}", new review.Routing.HomeRouteHandler())
);
Any ideas on this, maybe im missing something here!
Thanks!
Use a trailing slash instead (It works for me anyway)
routes.Add(
"Home",
new Route("{PageIndex}/", new review.Routing.HomeRouteHandler())
);
I don't know much about ASP.NET routing, but this article may help:
http://haacked.com/archive/2008/12/15/redirect-routes-and-other-fun-with-routing-and-lambdas.aspx
精彩评论