Link to home
Start Free TrialLog in
Avatar of juststeve
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?
Avatar of REA_ANDREW
REA_ANDREW
Flag of United Kingdom of Great Britain and Northern Ireland image

Could you not use a class?>
ASKER CERTIFIED SOLUTION
Avatar of Sam_Jayander
Sam_Jayander

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Sam_Jayander
Sam_Jayander

Avatar of juststeve

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.AppSettings("connStr")

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"/>