Where do I put my URL routes to prevent an IIS restart?
I am writing this code in global.asax
to save routes
RouteTable.Routes.Add("Profile", new Route("Profile/{ID}", new ProfileHandler("~/Member/Profile.aspx")));
and then writing this in the handler
var display = BuildManager.CreateInstanceFromVirtualPath(_virtualPath, typeof(Page)) as Profile;
//Setting Page Parameters
display.MemberId = Co开发者_高级运维nvert.ToInt32(requestContext.RouteData.Values["ID"]);
But I don't like this code. First I am writing hard coded values, and second what if my website is online and I want to republish it? I'll have to stop IIS. Any other ideas to save them?
I've written a whole blog with my own implementation of editable routes. I should make this into a NuGet package. My blog post covers how to have editable routes without requiring an app domain restart.
精彩评论