Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 getting connectionstrings in a class library proje

Author  Topic 

rtutus
Aged Yak Warrior

522 Posts

Posted - 2007-08-02 : 12:52:22
Hi,

I am using 2.0, I use this code in a dll class library project:

System.Configuration.Configuration rootWebConfig =
System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~/");
System.Configuration.ConnectionStringSettings connString;

But I get this error while compyling:

The type or namespace name 'Configuration' does not exist in the namespace 'System.Configuration' (are you missing an assembly reference?)

The same code works well while including it in a web project. I dont see why i doesn t work while in a dll class library project. Should add some specefic references or something?

Notice that that s the same code sample in msdn for reading connection strings, here:

http://msdn2.microsoft.com/en-us/library/ms178411.aspx

Thanks a lot
__________________
   

- Advertisement -