Skip to content

Use AppSettingsReader!

January 22, 2016
This is something that is useful and is a very general tip,m you can use the AppSettingsReader from System.Configuration to read a key value set in the web.config.

 System.Configuration.AppSettingsReader settingsReader =
 new AppSettingsReader();

 //Get your key from config file!

 string key = (string)settingsReader.GetValue("AValue",

//This is saved here in the web.config

 <add key="AValue" value="hereismyvalue" />

This is very useful for using the same string on many Controller classes for example!

From → Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: