Could i access ConnectionStringSettingsCollection ( Web.Config ) in Class Library?

  • Thread starter Thread starter Serdge Kooleman
  • Start date Start date
S

Serdge Kooleman

Could i access Web.Config in Class Library?

Next line work fine in web project that consist Web.config:

strConnString =
System.Web.Configuration.WebConfigurationManager.ConnectionStrings["CONN"].ConnectionString;

but when i call it from class library it give an error:

The type 'System.Configuration.ConnectionStringSettingsCollection' is
defined in an assembly that is not referenced. You must add a reference to
assembly 'System.Configuration, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a'. C:\Inetpub\wwwroot\Ra\RaLib\RaLib\cDB.cs
26 13 RaLib


Thank you
 
Yes, you an (in fact, behind the scenes your aspnet pages *become* a
library (dll)) - you just need to follow the instruction it gives you
and add a reference to System.Web

Marc
 
Back
Top