How to obtain the path of the current application for Windows form and web form
System. appdomain. currentdomain. basedirectory
Or
System. appdomain. currentdomain. setupinformation. applicationbase
The following are the execution results for obtaining the path of the current application:
Web form
System. environment. currentdirectory:
C: \ Program Files \ Microsoft Visual Studio 9.0 \ common7 \ ide
System. appdomain. currentdomain. basedirectory:
F: \ pratice \ appcurrentrunpath \ webformpath \
System. appdomain. currentdomain. setupinformation. applicationbase:
F: \ pratice \ appcurrentrunpath \ webformpath \
System. Io. Directory. getcurrentdirectory ():
C: \ Program Files \ Microsoft Visual Studio 9.0 \ common7 \ ide
Windows form
System. environment. currentdirectory:
F: \ pratice \ appcurrentrunpath \ windowsformspath \ bin \ debug
System. appdomain. currentdomain. basedirectory:
F: \ pratice \ appcurrentrunpath \ windowsformspath \ bin \ debug \
System. appdomain. currentdomain. setupinformation. applicationbase:
F: \ pratice \ appcurrentrunpath \ windowsformspath \ bin \ debug \
System. Windows. Forms. application. startuppath:
F: \ pratice \ appcurrentrunpath \ windowsformspath \ bin \ debug
System. Io. Directory. getcurrentdirectory ():
F: \ pratice \ appcurrentrunpath \ windowsformspath \ bin \ debug
Reference:
C # method set for obtaining the current program running path
Http://www.cnblogs.com/cocoulong/archive/2010/01/30/1660119.html
C # obtain the path of the current application
Http://www.cnblogs.com/baaigeini/archive/2009/03/09/1407078.html