asp.net c# create a new page and refresh routing map <p>I am using the <a href="https://github.com/Haacked/RouteMagic" rel="nofollow">routemagic</a> library and it works great. Except when I create a new page it doesn't refresh the route map.</p> <p>this is my save action:</p> <pre><code> protected void lbSave_Click(object sender, EventArgs e) { //save data to database; //recompile the route.cs var assembly = BuildManager.GetCompiledAssembly("~/Config/Routes.cs"); var registrar = assembly.CreateInstance("Routes") as IRouteRegistrar; } </code></pre> <p>in the Config/Route.cs class I have a foreach loop that ties the slug to the ID:</p> <pre><code>routes.MapPageRoute(events.Slug, events.Slug, "~/index.aspx?id=" + events.ID, true, new System.Web.Routing.RouteValueDictionary { { "id", events.ID } }); </code></pre> <p>but i still keep getting a 404 page for all new pages unless i refresh IIS..What I would need to do is add a new MapPageRoute everytime I create a new "event" to avoid the 404.</p>