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 FilesMicrosoft Visual Studio 9.0Common7IDE
System. AppDomain. CurrentDomain. BaseDirectory:
F: PraticeAppCurrentRunPathWebFormPath
System. AppDomain. CurrentDomain. SetupInformation. ApplicationBase:
F: PraticeAppCurrentRunPathWebFormPath
System. IO. Directory. GetCurrentDirectory ():
C: Program FilesMicrosoft Visual Studio 9.0Common7IDE
Windows Form
System. Environment. CurrentDirectory:
F: PraticeAppCurrentRunPathWindowsFormsPathinDebug
System. AppDomain. CurrentDomain. BaseDirectory:
F: PraticeAppCurrentRunPathWindowsFormsPathinDebug
System. AppDomain. CurrentDomain. SetupInformation. ApplicationBase:
F: PraticeAppCurrentRunPathWindowsFormsPathinDebug
System. Windows. Forms. Application. StartupPath:
F: PraticeAppCurrentRunPathWindowsFormsPathinDebug
System. IO. Directory. GetCurrentDirectory ():
F: PraticeAppCurrentRunPathWindowsFormsPathinDebug
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