Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 241
  • Last Modified:

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!
0
Starr Duskk
Asked:
Starr Duskk
1 Solution
 
EyalCommented:
try this

        routes.MapPageRoute("",
    "/Category/{CategoryId}/{Digest}",
    "~/Content.aspx")


        routes.MapPageRoute("",
    "/Content/{contentId}",
    "~/Content.aspx")
0
 
Starr DuskkASP.NET VB.NET DeveloperAuthor Commented:
thanks! I'll give it a shot.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now