开发者

Switching appSettings file path at runtime in ASP.Net MVC

I have an ASP.Net MVC 2 (C#) project where I want the user to be able to specify which config/appSettings file he would like to use through setting a URL parameter. (mysite?config=someConfig).

I was wondering what was the best way to do this. Is it wise of me to not use ConfigurationManager.AppSettings object at all, and instead create my own configuration manager that can access the URL parameters to decide on which file to read from? Or is it possible for me to override the path used by ConfigurationManager.AppSettings at runtime, so that I can continue using it as before?

Are there any good examples for a good configuration architecture for ASP.Net (MVC) that will support the kind of functionality I am af开发者_开发百科ter here? I was thinking this may be a common use case, and that some people may have experience enough on the subject to hint me in the right direction.

Thank you in advance.


Each web application restarts every time you change the underlying Web.config. It’s not recommended to change it by user interaction. If you need to store user settings, ASP.NET profiles are the recommended concept.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜