My application requires that I have access to the file system. Regardless if the code runs on a web server or a console app, how can I get the root directory the application is running in. Something like C:\TheApplication...
Thanks!
My application requires that I have access to the file system. Regardless if the code runs on a web server or a console app, how can I get the root directory the application is running in. Something like C:\TheApplication...
Thanks!
Easiest is probably:
System.Reflection.Assembly.GetExecutingAssembly().Location
Hope this helps,
-Oisin
You can try this:
String path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
You can read more about the two classes here: