PC Review


Reply
Thread Tools Rate Thread

Constants and the Web.Config

 
 
William Ryan
Guest
Posts: n/a
 
      29th Jun 2003
WebConfig is made for storing such constants but there
are other methods as well. You can create a Module in
VB.NET or a class with Static Members in C# and query
your DB at the onset and populate these fields there. In
one case you change Web.Config when you want to make
changes, in the other you change you DB fields. Since
ADO.NET is probably how you'll access the data, they are
both essentially as dynamic as the other one.

However, there is one advantage to using the DB vs. Web
Config ---- although technically you can do the same
either way. If you write a simple encrypt/decrypt method
for a class, you can store the data in your DB encrypted
and decrypt it before use. You can write a simple app
for administration purposes that takes plain text and
encrypts it in your DB. Then you app can always decrypt
those fields. You can techincally do the same with a
Web.Config file, but it's a hassle because writing
parameters to a DB is a little simpler than walking an
XML tree and storing the data there.

I have some examples of both if you are interested, let
me know.

Good Luck,

Bill
>-----Original Message-----
>In general what is the best way to store site

constants.
>I am currently storing the database connection in the
>web.config and I have some other constants that should
>always be available, such as (E-Mail Removed), and
>SiteName. Should I store these in the web.config

also?
>Is there a scenario where I should store constants
>elsewhere?
>.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
dll config and web.config and Label Expressions (binding label text to dll config settings) CSharpner Microsoft ASP .NET 0 9th Apr 2007 11:00 PM
DTDs for machine.config, web.config, security.config available ? =?Utf-8?B?UGF1bCBLZW5uZWR5?= Microsoft Dot NET Framework 1 5th Feb 2007 06:42 AM
How to config the web.config for both Internal and External users using Windows and Forms Authentication? ABC Microsoft ASP .NET 1 24th Oct 2005 03:37 PM
Configuration Error - c:\winnt\microsoft.net\framework\v1.1.4322\Config\machine.config Ivan Microsoft ASP .NET 1 21st May 2004 06:18 AM
integer constants used with string constants Eric Newton Microsoft Dot NET Framework 3 14th Jan 2004 06:05 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:57 PM.