There are many ways to obtain the current path on the ASP. NET page, such as mappath and request object.
However, if you want to obtain the current directory, you will find that the above ath ATH and request cannot be used.
The solution mainly relies on httpcontext objects, such
Httpcontext. Current. Request. physicalpath; // obtain the complete physical path of the current page. For example, F:/xfu. nsqs/project/website/default. aspx
Httpcontext. Current. Request. physicalapplicationpath; // obtain the currentProgramThe running physical path is F:/xfu. nsqs/project/website/
Httpcontext. Current. server. mappath (@ "/"); this is the mappath in the page.
Httpruntime. appdomainapppath // This is a newly discovered and useful method.
Another method is to process the DLL file called in Asp.net. If you want to know the working directory of the current web site, you can use
System. appdomain. currentdomain. basedirectory