Using web.config in compiled code

MrRalina

New Member
Hi,<BR><BR>The following code works fine when used in a normal aspx page:<BR><BR> Dim objConn as New OleDbConnection ( ConfigurationSettings.AppSettings("ConnectionString") )<BR><BR><BR>However, when I put this exact same line in a function in a .vb file, on compilation into the /bin folder I get the following error:<BR><BR> C:InetpubwwwrootDatabase.vb(172) : error BC30451: Name 'ConfigurationSettings' is not declared.<BR><BR><BR>Can anyone tell me what I'm doing wrong, and how to fix it?<BR><BR><BR>Thanks in advance,<BR><BR><BR>JONI'm guessing you imported that System.Configuration Namespace, right?<BR><BR>Remember that ASP.NET files get certain namespace imports by default. While vb files get others. try importing or fully qualifying the class' name.Hi,<BR><BR>Of course, I had forgotten to import System.Configuration! Now the .vb file works fine.<BR><BR>Thanks for the help,<BR><BR>JON
 
Back
Top