I have a web site with some articles inside. Articles are accessed using a database writing results on a single page. When a certain article is to be access
Details: Would you be fine with
http://www.mysite/Articles?a={article-id}
If so Microsoft Friendly Urls would be good for you. You would not need to change any of your existing functionality, you would just need to add the package and then add one line to Global.asax file. Also all your other Url's would be clean (i.e. http://www.mysite/Articles, http://www.mysite/About). It works for Web Site/Forms but does not work for Web Pages (i.e. Web Matrix)
Solution:
In the Application_Start method add the following line
RouteConfig.RegisterRoutes(System.Web.Routing.RouteTable.Routes);
You will now have FriendlyURL's
Note: If you are using a web site you will need to delete the following files for it to work (It will work fine with Web forms. Once it becomes a stable release I am sure you wont need to delete these files)
Links To More Information:
Information on Microsoft's Friendly Url Package
I think you should use:
Eg.:
protected void Application_Start(object sender, EventArgs e)
{
RegisterRoutes(RouteTable.Routes);
}
public static void RegisterRoutes(RouteCollection routes)
{
routes.MapPageRoute("Articles",
"articles/{article-id}/",
"~/Articles.aspx");
}
& on "Articles.aspx.cs" you can get the "article-id" using:
string article-id = Page.RouteData.Values["article-id"] as string;