473,320 Members | 2,020 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Constants and the Web.Config

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 si*******@domain.com, and
SiteName. Should I store these in the web.config also?Is there a scenario where I should store constants
elsewhere?
.

Jul 19 '05 #1
0 3527

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: William Ryan | last post by:
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...
1
by: chris han | last post by:
Hi, all, I'm trying to use Conditional Compilation Statements in my code. using System; #define DEBUG public class MyClass { public static void Main() {
2
by: Kevin McNeish [C# MVP] | last post by:
Does anyone know how to set the project constants property for "All Configurations" programmatically? The following code does this by setting each project individually: foreach...
1
by: martin | last post by:
Hi, I am having a little trouble defining compiler constants and picking then up in my code. In the configuration manger I defined the constant "Martin" I then set the Project Configuration...
7
by: Don Wash | last post by:
Hi There! I'm trying to define constants so that I can refer those constants from any page of my ASP.NET website. I know I can use <appSettings> in web.config XML file but I don't want to parse...
2
by: David | last post by:
Hey evryone, I have a ASP.NET project that I'm working on and have been using a static class to store all my global constant information eg. MyGlobalClass.MyConnectionString. This has worked out...
8
by: Steve | last post by:
Running asp.net 2.0 I have never used global constants and I am a bit confused on the subject. I want to give the admin of an application a lot of control over display. i.e. custom error...
2
by: merkury1 | last post by:
Does C# have any predefined preprocessor constants like the C/C++ compiler does? In C++ you had such predefined constants as: __cplusplus, _DEBUG, _WIN32, MSC_VER. Are there any such things for...
2
by: Leslie Sanford | last post by:
I want to define a set of floating point constants using templates insteand of macros. I'd like to determine whether these constants are floats or doubles at compile time. In my header file, I have...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.