Wednesday, December 1, 2010

Reading App Settings from the Web.Config

For a Web Service that needs to read information form the web.config file (in its own virtual directory), the following is all you need to read the information:

using System.Configuration;
.
.
.
String value = ConfigurationManager.AppSettings["Param_1"].ToString();


The web.config file would contains something like this:











For more information, go to the following links:

http://www.dotnetfunda.com/articles/article13.aspx

The following link show how to read the root web.config file instead of the one in the virtual directory:

http://msdn.microsoft.com/en-us/library/610xe886.aspx

No comments: