Friday 23 August 2013

Access App setting Value

Leave a Comment
Just a quick tutorial how to get appSettings elements value from web.config

let say you want to access app Settings value in your web.config file...first thing you need to include in your code behind :  using System.Configuration

This code will enable you to access from your code behind value in web.config file at <appSettings></appSettings> element.

WebConfig file

 <appSettings>
    <add key="key" value="2.0.0.0" />
</appSettings>

Code Behind .cs

using System.Configuration;
:
:  
string KeyVal = ConfigurationManager.AppSettings["Key"].ToString();


and variable KeyVal will have value 2.0.0.0 after executing this code.


By
NOTE : – If You have Found this post Helpful, I will appreciate if you can Share it on Facebook, Twitter and Other Social Media Sites. Thanks =)

0 comments:

Post a Comment

Subscribe to our newsletter to get the latest updates to your inbox.

Your email address is safe with us!




Founder of developersnote.com, love programming and help others people. Work as Software Developer. Graduated from UiTM and continue study in Software Engineering at UTMSpace. Follow him on Twitter , or Facebook or .



Powered by Blogger.