Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get the file path of current application's config file

The reason I asked this question is that I wanted to create a helper class for Remoting instantiation, and wanted to pass the appropriate app.exe.config (or web.config) file path to the RemotingConfiguration.Configure method, depending on the caller.

Is there a way I could get the name of the config file for both Win and Web apps without checking if the application is Web or WinForms?

like image 977
dummy Avatar asked Jun 02 '10 11:06

dummy


1 Answers

You can use the ConfigurationFile property on the SetupInformation for AppDomain.CurrentDomain.

This will get either the web.config or and app.config (yourprogram.exe.config) location.

AppDomain.CurrentDomain.SetupInformation.ConfigurationFile
like image 70
Clement Avatar answered Oct 05 '22 23:10

Clement