C # How to obtain the project path

Source: Internet
Author: User
1.asp.net webform: Use "request. physicalapplicationpath" to obtain the physical path of the virtual directory of the site, and finally include "\"; 2.c# for winform
A: "application. startuppath": Get the current application ProgramPath of the Directory, excluding "\";
B: "application. executablepath": obtains the path of the current application file, including the file name;
C: "appdomain. currentdomain. basedirectory": gets the path of the directory where the current application is located, and finally contains "\";
D: "system. Threading. thread. getdomain (). basedirectory": gets the path of the directory where the current application is located, and finally contains "\";
E: "environment. currentdirectory": gets the path of the current application and does not contain "\".
F: "system. io. directory. getcurrentdirectory: Get the path of the current application, excluding "\"; 3.c# use "appdomain" for Windows service. currentdomain. basedirectory or system. threading. thread. getdomain (). basedirectory ";
Use "environment. currentdirectory" and "system. Io. Directory. getcurrentdirectory" to get the path of the "System32" Directory;
If you want to use "application. startuppath or application. executablepath, You need to manually add the "system. windows. forms. DLL. windows. forms "declares this reference;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.