当前位置: 动力学知识库 > 问答 > 编程问答 >

asp.net - 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 = Convert.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.

分享给朋友:
您可能感兴趣的文章:
随机阅读: