Saving ASP web application configuration in SQL database

By scantoria ·
I am in the process of building a simple web app for our company. I have a friend that mentioned about saving the application configuration in a database.

Please explain this concept or point out some sites that will give me more information about this technique.


This conversation is currently closed to new comments.

5 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

simple config

by BOUND4DOOM In reply to Saving ASP web applicatio ...

I do not know is your after something specific, but you basically create a table in the database with 2 columns, set one as a identy column use nvarchar(255) as the data type, set the other column as ntext. The Identity becomes your Key and the Ntext becomes your value, this works just like a hashtable or any other dictionary type collection object. Then just create a couple methods in a common include file one called getconfig, one called set config. Those set and get your values from your table so anytime you want a value from the database. You call getconfig("KeyName") to set a value you call setconfig("KeyName","Value").

If you really want to get fancy and get performance then acahe the config values in the application variables section of your site, so then when you call getconfig it check to see if the value is in memory before going to the database which is a lot faster, if it is not in memory then get the value from the database and put it in memory before returning it to you. Simple as that, similar to any hash table or dictionary collection. I do not know of any sites that show this though. This is really just basic dictionary collection style stuff.

Collapse -

Another approach...

by ward In reply to Saving ASP web applicatio ...

I like Doom's method, and have used it many times. In fairness I thought I should mention another approach. The configuration section of .NET can be descended from/overridden to read/write from anything you can write the code for. There is an article on MSDN about using this approach.

Collapse -

This is better in .net

by BOUND4DOOM In reply to Another approach...

This way is much better, in reality I would create custom config handlers and using config sections for what you are wanting and go from there. Using web config in a .net environment is a much prefered aproach. I guess we would need clarification if this is ASP or

I much prefer the web.config in .net because it is easy to work with and edit randomly like a developer might want to. Plus all the config information can be writen right out in a trace so you can see what is going on at the time. This really helps trouble shooting things. But if you are going with Classic asp. I would go with my previous post.

Collapse -

Don't overlook metabase backup

by Reality-based In reply to Saving ASP web applicatio ...

If the only need is for backup, and this is old ASP not, then you have an option to backup the metabase.

If your ASP site has a non-flat tree structure, that doesn't translate directly to a keyword=value list, you need a way to represent the branching.

Back to Software Forum
5 total posts (Page 1 of 1)  

Related Discussions

Related Forums