Configuration files (Web site and Dll project)

R

Rastko Soskic

I've posted this question earlier in framework group but had no luck with
answer... So I'd try here.
Any help/advice is appreciated. Thanks in advance.
In solution for now I have two projects.
1. I have dll project and dll project HAS its App.config (dll project is
middle tier)
there is for example:

class ObjectInDll
{
SqlConnection conn;
public ObjectInDll( )
{
conn = new
SqlConnection(ConfigurationManager.ConnectionStrings["connString"].ConnectionString;
// THERE IS connection string element with "connString" name in
Dll's config file
}
}
2. I have web site and web site has its web.config.
3. In page class Default.aspx.cs (let it be in Page_Load event)
ObjectInDll oid = new ObjectInDll();
// creation of ObjectInDll throws exception because THERE IS NO
connection string element with "connString" name within web.config.
So, my question is ( although I've solved problem by including Settings via
property page of dll project so I abandoned storing connection string in
config file)
*** How to solve this, if it is possible, without inclusion of Settings, or
if including Settings is good solution I can stop breaking my mind :))) (How
to make ConfigurationManager to read proper config file and not first he
steps on? because .NET stops searching for config file when it finds first
one, and web.config is first :) ) ***
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top