Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6906751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:20:59+00:00 2026-05-27T08:20:59+00:00

i have two project 1) class library with no inteface just an api 2)

  • 0

i have two project
1) class library with no inteface just an api
2) web application

from web apps i will be calling the class library api

so i have all the web.config settings in the web application but when i debug it always return me null value and here is the code snippit:

 public static string readingDB
        {
            get
            {
                string result = null;
                result = ConfigurationManager.AppSettings["employeeDB"]; //conn string
                if (!string.IsNullOrEmpty(result))
                {
                    return result;
                }
                else
                {
                    return "";  //???? THROW EXCEPTION???
                }
            }
        }

i have also tried, creating a new app.config in the class library project and have the same appsettings there but does not work…

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <applicationSettings>
    <add name="employeeDB" connectionString="Data Source=servername;Initial Catalog=employee;Persist Security Info=True;User ID=userid;Password=password;"/>
  </applicationSettings>
  <customErrors mode="On"/>
</configuration>

any help?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T08:21:00+00:00Added an answer on May 27, 2026 at 8:21 am

    your syntax is incorrect, it should be

    <configuration>  
      <appSettings>  
        <add key="employeeDB" value="Data Source=servername;Initial Catalog=employee;Persist Security Info=True;User ID=userid;Password=password;"/> 
      </appSettings>  
    </configuration>  
    

    or more correctly, since it’s a connection string,

    <configuration>  
      <connectionStrings>  
        <add name="employeeDB" connectionString="Data Source=servername;Initial Catalog=employee;Persist Security Info=True;User ID=userid;Password=password;"/>  
      </connectionStrings>  
    </configuration>  
    

    which would be read by ConfigurationManager.ConnectionStrings["employeeDB"]

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two projects which is calling a Class Library. Can i in my
I have two classes in two files in a class library project, they are:
I have a vb.net 3.5 class library project that needs to reference two assemblies
I have a console application and two class library projects. The console application has
I have an solution in VS 2008 which contains two class library projects and
We have two projects that are both class libraries. Project 1 is a VS
Suppose my solution have two project: myApp: silverlight application project: the default application App
I have two libraries and a single application assembly project layout and I'm wondering
I have two projects, the DLL project which has all my logic and data
I have two projects: A/B. Project A is the project that contains all of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.