For Programmers: Free Programming Magazines  


Home > Archive > ASP .NET > June 2005 > Global Variables!q









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Global Variables!q
Child X

2005-06-11, 3:58 am

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!!
Saeid

2005-06-11, 8:57 am

If the variable is same to all users, so you can add them to the cach.
Regards
Saeid Kdaimati

"Child X" wrote:

> 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!!

Brock Allen

2005-06-11, 3:58 pm

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...igretrieve.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



> 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!!
>




Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com