URL Routing - SEO Feature in ASP.NET4
//Include in Global.asax
using System.Web.Routing;
void RegisterRoutes(RouteCollection routes)
{
routes.MapPageRoute("list-show", "List/{type}", "~/List.aspx");
}
Code to be included in Application_Start
void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup
RegisterRoutes(RouteTable.Routes);
}
Code to be added in default.aspx
List / People
List / Books
List / General
Get the listtype from RouteData
//code to be written in List.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
string listtype = Page.RouteData.Values["type"] as string;
Label1.Text = listtype;
}