Link to home
Start Free TrialLog in
Avatar of Starr Duskk
Starr DuskkFlag for United States of America

asked on

VS2010 URL rewriting for Web Forms

I'm trying to use this aritcle, and I'm confused:
http://weblogs.asp.net/scottgu/archive/2009/10/13/url-routing-with-asp-net-4-web-forms-vs-2010-and-net-4-0-series.aspx

I want to rewrite my webform to an SEO friendly url. For instance, my real page is:
 "~/Display.aspx?ContentId=1&CategoryId=90&SubCategoryId=3&Digest=true")

It usually has only one of the above options. Either a ContentId, where it will show just the ONE record, or a CategoryId, where it will shows All records under that category, same with SubCategory, and if I pass in Digest, it will display the short version. So those are the allowed parameters.

        routes.MapPageRoute("",
    "NewPageNameOne",
    "~/Content.aspx?ContentId=1&CategoryId=90&SubCategoryId=3&Digest=true")

So should I create a path:

        routes.MapPageRoute("",
    "/Category/{CategoryId}{Digest}",
    "~/Content.aspx?CategoryId=90&Digest=true")

And if I use the ContentId instead:

        routes.MapPageRoute("",
    "/Content/{contentId}",
    "~/Content.aspx?ContentId=1")

And I would add both to the global.asax? How would I set up the file?

thanks!
ASKER CERTIFIED SOLUTION
Avatar of Eyal
Eyal
Flag of Israel image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Starr Duskk

ASKER

thanks! I'll give it a shot.