Tuesday, November 15, 2011

Passing the values from App.config to code behind page using c# || Get key values from config file in asp.net

In this post i will show how to fetch the values from configuration file using C#.net.If we want to use the parameter value for entire application in csharp we have a key value  option in  app.config file.I have shown a simple example for giving the  server name to application using key value.

App.config :
<add key="Email" value="servername"/>

Code Behind:
string servername=ConfigurationManager.AppSettings["servername"].ToString(); 

No comments: