Created
June 27, 2011 14:29
-
-
Save aturgarg/1048962 to your computer and use it in GitHub Desktop.
Get EXE config data dynamically
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private static string exePath = System.Reflection.Assembly.GetExecutingAssembly().Location.ToString(); | |
| if (!string.IsNullOrEmpty(servicePath)) | |
| { | |
| Configuration config = ConfigurationManager.OpenExeConfiguration(exePath); | |
| //here fetching the data from AppSettings with key name "UserName" | |
| string userName = config.AppSettings.Settings["UserName"].Value.ToString(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment