It is possible but you will need to write own logic to handle route collection and update based on add/remove to collection.
Code below is just to show basics on how something like this can be achieved. There are many ways to dynamically store and have user update routes.
In Global.asax assume you have some predefined route:
void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup
RegisterRoutes(RouteTable.Routes);
}
void RegisterRoutes(RouteCollection routes)
{
routes.MapPageRoute("RouteDirect", "about/{user}", "~/about.aspx");
}
Now About.aspx has a way to read route value.
protected void Page_Load(object sender, EventArgs e)
{
if (Page.RouteData.Values["user"] != null)
{
TextBox1.Text = Page.RouteData.Values["user"].ToString();
}
}
If you browse to localhost:51604/about/john
You will see john in textbox.
Below is simple example on how you can add/remove routes. You can extend on this logic to suit your needs where you can show all existing routes on an secure page for your content team and provide them ability to add/remove/disable route or have more complex way to specify route parameters etc.
protected void Button1_Click(object sender, EventArgs e)
{
//Adding New Route on Button Click
RouteTable.Routes.MapPageRoute("RouteDirectNew", "aboutnew/{user}", "~/about.aspx");
//Now route table has 2 routes:
// about/{user}
// aboutnew/{user}
}
protected void Button2_Click(object sender, EventArgs e)
{
//Removing new route on button click
RouteCollection rcollection = new RouteCollection();
rcollection = RouteTable.Routes;
Route ToDeleteRoute = null;
foreach (Route r in rcollection)
{
if (r.Url == "aboutnew/{user}")
ToDeleteRoute = r;
}
if(ToDeleteRoute != null)
RouteTable.Routes.Remove(ToDeleteRoute);
//Now route table has only 1 route the original added via global.asax:
// about/{user}
}