I\'m trying to use ASP.NET WebPages to make sense of an existing site which uses static .html files (about 500 of them). Unfortunately, my SEO person is requiring that the
You want to use routing. Are you using webforms or MVC? Global.asax is a good start. Add the complete code here:
namespace Name
{
public class Global : System.Web.HttpApplication
{
protected void Application_Start(object sender, EventArgs e)
{
RegisterRoutes(RouteTable.Routes);
}
protected void Session_Start(object sender, EventArgs e)
{
}
protected void Application_BeginRequest(object sender, EventArgs e)
{
}
protected void Application_AuthenticateRequest(object sender, EventArgs e)
{
}
protected void Application_Error(object sender, EventArgs e)
{
}
protected void Session_End(object sender, EventArgs e)
{
}
protected void RegisterRoutes(RouteCollection routes)
{
routes.MapPageRoute("Route1", "OldPage.html", "~/NewPage.aspx");
}
protected void Application_End(object sender, EventArgs e)
{
}
}
}
Obviously you don't want to manually add 500 routes but you can add url filters.
See: http://msdn.microsoft.com/en-us/library/cc668201.ASPX
ASP.NET routing enables you to use URLs that do not have to map to specific files in a Web site.