开发者

storing settings in asp.net application

开发者 https://www.devze.com 2023-01-29 13:43 出处:网络
there are few variables in my applicati开发者_开发百科on which i need to set and are used at various places.

there are few variables in my applicati开发者_开发百科on which i need to set and are used at various places. Which is the best place other than web.config file to store them.


Write a class with static members that are set on Application_Start() inside global.asax


If these variables can change their values after application has been built then web.config is the best place to store them. Other options can be database, registry or in short, any persistent medium. Of course, to use these values through-out your application, you should have a wrapper static class that will expose these settings as properties. Settings will be read once at application start-up (or on demand whenever first requested.)

0

精彩评论

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