Current ASAX Code (Simplified):
void Application_Start(object sender, EventArgs e)
{
RegisterRoutes(RouteTable.Routes);
}
void RegisterRoutes(RouteCollection routes)
{
routes.Add("ContactUsRoute",
new Route("contact-us",
new PageRouteHandler("~/contactus.aspx")));
}
Question
Is it safe to pull routes from the database at this point? For instance:
void RegisterRoutes(RouteCollection routes)
{
routes.Add("ContactUsRoute",
new Route("contact-us",
new PageRouteHandler("~/contactus.aspx")));
var dbRoutes = BusinessLogic.GetPageRoutes();
foreach (Route route in dbRoutes)
{
routes.Add(route);
}
}
Additional Information
This question arises from a lack of knowledge about routing, as well as a general lack of knowledge with global.asax. I used global.asaxto use it only for extremely simple tasks; DB feels like I'm moving to another level.
source
share