juststeve
asked on
Storing info in Web.config
I have a handful of methods spread across a handful of pages that act differently depending on whether or not the contents of a Session var are in one of two possible groups:
if idDept = Active
I'd like to store an array of active deparments in Web.config so that any method needing that info looks to that array.
How would i create that key in .config and how would code access that the array?
if idDept = Active
I'd like to store an array of active deparments in Web.config so that any method needing that info looks to that array.
How would i create that key in .config and how would code access that the array?
Could you not use a class?>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Refer,
http://support.microsoft.com/default.aspx?scid=kb;en-us;309045
http://www.codeproject.com/aspnet/KarlSegCustomConfig.asp
to create and access custom configuration section.
Regards,
Sam
http://support.microsoft.com/default.aspx?scid=kb;en-us;309045
http://www.codeproject.com/aspnet/KarlSegCustomConfig.asp
to create and access custom configuration section.
Regards,
Sam
ASKER
Probably...but to my way to thinking it seems easiest/cleanest to not create a new entity for something like this. I save my db's connection strings there making that string availiable to all page via a simple:
Dim connStr As String = ConfigurationSettings.AppS ettings("c onnStr")
So that would seem to be half my answer...create a key/value pair in <appSettings>:
<add key="idDept" value="1,5,6,9,14"/>
Dim connStr As String = ConfigurationSettings.AppS
So that would seem to be half my answer...create a key/value pair in <appSettings>:
<add key="idDept" value="1,5,6,9,14"/>