create and read entry from web.config

  • Thread starter Thread starter Grey
  • Start date Start date
G

Grey

I want to create one element in web.config file, but i don't know how..

Please teach me how to create and read the element from web.config.

Million Thanks.
 
Web.config file is a convenient palce for storing constants,values, keys etc.. Each folder in your web application can contain a seperate web.config file. when CLR reads any files from the folder, it checks the presence of web.config file and reads the configuration for it. Its very simple to read any key from the web.config file. for example insert a key called "name" between the appsetings tag in web.config file. following shows how

<configuration><!-- application specific settings --><appSettings><add key="name" value="Mr. grey" /></appSettings><system.web
..
</system.web></configuration

now in your webform or windows form use the following statime to read the settings

ConfigurationSettings.AppSettings("name"

-happy programmin
 
Back
Top