string strRealPath = Request.ApplicationPath;//得到虚拟目录
Session["strRealPath"] = strRealPath;
string strFilePath = Request.PhysicalApplicationPath;//得到物理路径
Session["strFilePath"] = strFilePath;
Session["strRealPath"] = strRealPath;
string strFilePath = Request.PhysicalApplicationPath;//得到物理路径
Session["strFilePath"] = strFilePath;
获取应用程序的当前工作目录。
System.IO.Directory.GetCurrentDirectory()
AppDomain.CurrentDomain.BaseDirectory
这两个只能在WindowForm中使用;
Application.StartupPath
Application.ExecutablePath
--获取和设置当前目录(即该进程从中启动的目录)的完全限定路径。
Environment.CurrentDirectory
--获取启动了应用程序的可执行文件的路径,包括可执行文件的名称。
Application.ExecutablePath
感谢秋枫!我都受益了!