473,378 Members | 1,344 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,378 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 3535

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...
1
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: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.