473,410 Members | 1,976 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,410 software developers and data experts.

Global Constants

Hi,

I am working on converting a classic asp site to asp.net. The site
has an include file full of constants that are used across the site.
This file can be dynamically updated and any changes take effect
instantly with no impact on the site (IE the site does not need to be
restarted/recycled in the same way an update to a web.config file
would). This file basically just holds label values so the names can
be changed as and when needed through a web page.

CONST strMaleLabel = "Gents"
CONST strFemaleLabel = "Ladies"

eg. On one page there may be a form asking for input of two values:

Ladies: 0
Gents: 0
The "Ladies" and "Gents" labels are contstants in an include file (as
above) and when changed through a backend webpage the include file is
re-written so the next time the page loads the labels could be
different:

CONST strMaleLabel = "Guys"
CONST strFemaleLabel = "Gals"
Gals: 0
Guys: 0

All of these label values are also stored in a SQL database but I
guess the include file was deemed less of an overhead than an
additional call to the database for every page (the include file is 9K
loads of constants!) .
Can anyone tell me the best way to convert this to asp.net or give
thoughts on doing away with the include and making that call to the db
every page load.
Many Thanks

Fred

Feb 14 '07 #1
1 1432
wel you could easily mimick this behavior with a configuration file ( XML ,
INI or whatever )

regards

Michel Posseth
"Fred" <fr**@fredthomas.co.ukschreef in bericht
news:11*********************@m58g2000cwm.googlegro ups.com...
Hi,

I am working on converting a classic asp site to asp.net. The site
has an include file full of constants that are used across the site.
This file can be dynamically updated and any changes take effect
instantly with no impact on the site (IE the site does not need to be
restarted/recycled in the same way an update to a web.config file
would). This file basically just holds label values so the names can
be changed as and when needed through a web page.

CONST strMaleLabel = "Gents"
CONST strFemaleLabel = "Ladies"

eg. On one page there may be a form asking for input of two values:

Ladies: 0
Gents: 0
The "Ladies" and "Gents" labels are contstants in an include file (as
above) and when changed through a backend webpage the include file is
re-written so the next time the page loads the labels could be
different:

CONST strMaleLabel = "Guys"
CONST strFemaleLabel = "Gals"
Gals: 0
Guys: 0

All of these label values are also stored in a SQL database but I
guess the include file was deemed less of an overhead than an
additional call to the database for every page (the include file is 9K
loads of constants!) .
Can anyone tell me the best way to convert this to asp.net or give
thoughts on doing away with the include and making that call to the db
every page load.
Many Thanks

Fred

Feb 15 '07 #2

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

Similar topics

1
by: mark4asp | last post by:
What are the best methods for using global constants and variables? I've noticed that many people put all global constants in a file and include that file on every page. This is the best way of...
10
by: Matt | last post by:
Greetings, What are people's thoughts on global variables in C++? Why are we taught not to use them in programming? Is it true that if you are running two copies of the C program one copy can...
20
by: 2obvious | last post by:
I've been trying to create read-only global variables by creating constants (Const) in my global.asa, but I can't seem to reference them. Sticking them in an include works fine, but it seems more...
1
by: Xiangliang Meng | last post by:
Hi, all. Recently, I find there is a way in our project to maintain a global set in many files by using preprocessing directives. I'm wondering if we could find a better method for this. Many...
25
by: Daniel Bass | last post by:
how do i declare a global variable in c#.net? it's like it want's everything in classes... there are times when globals are good, like having constants in a program which apply to several...
4
by: Amadelle | last post by:
Hi all and thanks again in advance, What is the best way of defining global constants in a C# application? (A windows application with no windows forms - basically a set of classes). Would it be...
8
by: Marty | last post by:
Hi, I'm new to C#, I used to code in VB.NET. Where is the best place to declare all my constants and global objects in my C# project to have them accessible globally? I have an event logger...
1
by: 2obvious | last post by:
I want to declare some constants on the application level in global.asax to use throughout my application, e.g.: Sub Application_OnStart() Const NUM As Integer = 5 End Sub Problem is, when I...
8
by: Thomas Coleman | last post by:
Ok, I've obviously discovered that Global.aspx has been completely changed in ..NET 2.0. However, I haven't figured out how to declare a constant that's available to any page in my application...
6
by: lazy | last post by:
hi, I have some constants defined in a php script say config.php. I want to use the variables there defined in other scripts. couple of questions regd that: 1. Is there an alternative to...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.