I have just started adding the new .NET 4.0 URL Rewriting into my project. I have a question.
Let's say I have a Article.aspx that displays, well, articles. I made a route for it in the Global.asax:
routes.MapPageRoute("article-browse", "article/{id}", "~/Article.aspx");
So the link consists of the article's id which is, obviously, not a very nice, nor SEO friendly link. I would like to display the Article's title in the link, instead of the ID.
Do I have to pass the whole title in the parameter (instead of the id) and then make a SQL query that searches for a database record with the matching title? That sounds scary. Maybe there is some way to do something similar to the Eval() methods, that would change the title into an ID?
Thank you very much!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…