Praveen Prasad
Praveen Prasad

Reputation: 32107

storing settings in asp.net application

there are few variables in my application which i need to set and are used at various places. Which is the best place other than web.config file to store them.

Upvotes: 2

Views: 112

Answers (2)

J. Mitchell
J. Mitchell

Reputation: 348

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

Upvotes: 3

VinayC
VinayC

Reputation: 49165

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.)

Upvotes: 2

Related Questions