Starr Duskk
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&Category Id=90&SubC ategoryId= 3&Digest=t rue")
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&Category Id=90&SubC ategoryId= 3&Digest=t rue")
So should I create a path:
routes.MapPageRoute("",
"/Category/{CategoryId}{Di gest}",
"~/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!
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=
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=
So should I create a path:
routes.MapPageRoute("",
"/Category/{CategoryId}{Di
"~/Content.aspx?CategoryId
And if I use the ContentId instead:
routes.MapPageRoute("",
"/Content/{contentId}",
"~/Content.aspx?ContentId=
And I would add both to the global.asax? How would I set up the file?
thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER