question about webconfigurationmanager.appsettings

Discussion in 'Microsoft Certification' started by =?Utf-8?B?QWhtYWQ=?=, Oct 23, 2006.

  1. This works in a C#ASP.NET Website application:
    string strSQL = WebConfigurationManager.AppSettings["ConnString"].ToString();

    However if I try using this statement in a c#dll class library, I get the
    error:
    'Object Reference not set to an instance of an object'

    I've looked on the internet, and whilst a number of people have registered
    this problem, no-one has yet provided a solution. Can you provide one please?

    Regard,

    Ahmad
     
    =?Utf-8?B?QWhtYWQ=?=, Oct 23, 2006
    #1
    1. Advertising

  2. Is it possible that C#DLL security settings are tighter than C#ASP.NET ones,
    in the sense that the DLL(in its natural state) doesn't have permission to
    read a web.config file, whereas a C#ASP.NET file does?



    "Ahmad" wrote:

    > This works in a C#ASP.NET Website application:
    > string strSQL = WebConfigurationManager.AppSettings["ConnString"].ToString();
    >
    > However if I try using this statement in a c#dll class library, I get the
    > error:
    > 'Object Reference not set to an instance of an object'
    >
    > I've looked on the internet, and whilst a number of people have registered
    > this problem, no-one has yet provided a solution. Can you provide one please?
    >
    > Regard,
    >
    > Ahmad
     
    =?Utf-8?B?QWhtYWQ=?=, Oct 23, 2006
    #2
    1. Advertising

  3. "Ahmad" <> wrote in message
    news:...
    > This works in a C#ASP.NET Website application:
    > string strSQL =

    WebConfigurationManager.AppSettings["ConnString"].ToString();
    >
    > However if I try using this statement in a c#dll class library, I get the
    > error:
    > 'Object Reference not set to an instance of an object'
    >
    > I've looked on the internet, and whilst a number of people have registered
    > this problem, no-one has yet provided a solution. Can you provide one

    please?
    >
    > Regard,
    >
    > Ahmad


    Wrong newsgroup
     
    Jonathan Roberts, Oct 24, 2006
    #3
    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. Wayne
    Replies:
    0
    Views:
    727
    Wayne
    Mar 2, 2004
  2. eddiec
    Replies:
    6
    Views:
    974
    Zenner
    May 20, 2004
  3. c.reifert

    Actually, a wav question instead of mp3 question

    c.reifert, Dec 3, 2004, in forum: Computer Support
    Replies:
    11
    Views:
    893
    °Mike°
    Dec 3, 2004
  4. Jørgen Gilberg
    Replies:
    1
    Views:
    1,078
  5. SPD
    Replies:
    1
    Views:
    1,191
    Jørgen Gilberg
    Aug 13, 2003
Loading...

Share This Page