Configuration files (Web site and Dll project)

Discussion in 'ASP .Net' started by Rastko Soskic, Dec 27, 2006.

  1. 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 :) ) ***
    Rastko Soskic, Dec 27, 2006
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ethan V
    Replies:
    2
    Views:
    4,978
    Ethan V
    Jun 25, 2006
  2. John Dalberg
    Replies:
    1
    Views:
    501
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Mar 28, 2007
  3. ITistic
    Replies:
    2
    Views:
    416
    ITistic
    Aug 21, 2007
  4. Replies:
    0
    Views:
    482
  5. H. Simpson
    Replies:
    4
    Views:
    248
    H. Simpson
    Aug 3, 2004
Loading...

Share This Page