i agree with vko, depending on what you mean by "global variable" was it
just a static field (good) or using the Application object (bad) ?
Also, not that the web.config is cached internally...so perf won't change
much..more about usability...and I think vko's example provides the greatest
abstraction.
For the record, I only ever use custom configurations, so that's how I do
it:
http://openmymind.net/Configuration/index.html
Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
Vko said:
In my projects I use an utility class like that :
public sealed class Settings
{
private static string connectionString = "";
public static string ConnectionString
{
get { return connectionString; }
}
static Settings ()
{
ConnectionString = ...AppSettings["connectionString"];
}
}
alaspin said:
The last project I worked on we held the value in web.config but used the
Application_Start event to populate a global variable.
Was this "worth" it? Or should we have just stuck with GetConfiguration
calls each time?
My thinking was get the valule in memory and save the file read each time...
What do you guys think?
(e-mail address removed)
:
where is the best place to put the connection string for use through-out my
app?
right now I use, in every page/sub/etc:
SqlConnect = New SqlConnection("Server=xxxx;uid=xxx;pwd=xxxx;database=xxx")
for sql server 2k connection
This connection is for all users,and is the only connection for this app.
maybe in the Global.asax or webconfig file???
thanx!