We can use Web.Config file to store any string value and that can be used in our ASP.NET application. After deploying the application also we can change the value in the config file. To do so,
In Web.Config file add a key and value that can be used in your application within the appSettings tags like below.
In Web.Config file add a key and value that can be used in your application within the appSettings tags like below.
<configuration> <appSettings> <add key="KEYNAME" value="KEYVALUE"/> </appSettings> </configuration>To retrieve the value use the below code,
string value = System.Configuration.ConfigurationManager.AppSettings["KEYNAME"].ToString();
No comments:
Post a Comment