Andrew Florko
Andrew Florko

Reputation: 7750

Configuring asp.net web applications. Best practices

There is a lot of configurable information for a web-site:

There are many approaches to store all this information also:

What approaches do you usually choose for your tasks & what approaches do you find unsuitable?

Thank you in advance!

Upvotes: 5

Views: 792

Answers (1)

derek
derek

Reputation: 4886

these are all very subjective and depend on the type of site you have, but here are my two cents:

UI messages - if multi-lingual, store them in resource files

Number of records used in pagination & other UI parameters - I like to make this selectable by the users, if using jquery to do this plugins such as tablesorter and tablesorter.pager make it easy

Cache duration for web-pages & timeouts - really depends on how time sensitive your data is. If content is updated frequently, you may not want to cache it for long. But if there is a lot of code to retrieve and organize the data, you may want to cache it for longer to improve performance.

Route maps & site structure - really dependent on what type of site you have and whether it will benefit the users

AppSettings (web.config) - good for constants and items that won't change often, or are specific to that installation, such as base url, webservice url, google api keys, etc

Custom sections (web.config) - can be good for settings that don't conform well to the dictionary format, one key to one value.

External xml/text files referred from web.config - I use this as a last resort, might nust be preference, but I hate using file i/o on the site.

Internal static class(es) of constants - Good approach to store settings that are loaded from the db, to avoid a db hit everytime you need the values

Database table(s) - when using db tables for settings, I prefer to load them into a static class and refresh it periodically, to avoid having to hit the db everytime I need the data

Upvotes: 2

Related Questions