Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use ConfigurationManager Class in a Class Library Project type

I have one class Library Project for Payment. The live credential of client is on web.config file of website and this class library project will added in bin in form of dll. So How to get ConfigurationManager in Class Library So I can get credential of Client and make Payment

like image 317
Akil Vhora Avatar asked Nov 05 '11 09:11

Akil Vhora


People also ask

What is the use of ConfigurationManager in C#?

The ConfigurationManager class enables you to access machine, application, and user configuration information. This class replaces the ConfigurationSettings class, which is deprecated. For web applications, use the WebConfigurationManager class.

Can class library have app config?

Class libraries can access configuration settings in the same way as executable apps, however, the configuration settings must exist in the client app's App. config file.

Does ConfigurationManager work in .NET core?

ConfigurationManager was added to support ASP.NET Core's new WebApplication model, used for simplifying the ASP.NET Core startup code.

What is System configuration ConfigurationManager Appsettings?

GetSection(String) Method (System. Configuration) Retrieves a specified configuration section for the current application's default configuration.


1 Answers

Add Reference System.Web to your Class Library.

like image 119
Manideep Innamuri Avatar answered Sep 25 '22 11:09

Manideep Innamuri