Global Variables!q

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all,

I am still new to .net.
Coming from an asp classic background.

Using classic asp, i would use a include file to contain global variables
contained through out a site. These would normally be file system paths and
the like.

What would be the best approach to achieving this in dotnet.
Because they are only variables using a class seems overkills so does a user
control.

Thanks for any replies!!
 
If the variable is same to all users, so you can add them to the cach.
Regards
Saeid Kdaimati
 
Depends upon what youre global variable is for. If it's something like a
connection string, which was typically stored in global.asa in classic ASP,
then I'd suggest putting that value into the <appSettings> section of web.config.

http://www.dotnetjunkies.com/QuickS...l=/quickstart/aspplus/doc/configretrieve.aspx

If instead the variable is an actual constant, then I'd suggest looking into
static (C#)/Shared (VB.NET) variables. staic/Shared means there's one shared
copy of the variable for the entire application.

-Brock
DevelopMentor
http://staff.develop.com/ballen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top