您好,欢迎来到化拓教育网。
搜索
您的当前位置:首页C# MVC 获得程序运行路径

C# MVC 获得程序运行路径

来源:化拓教育网
            string filePath = System.Web.HttpContext.Current.Request.MapPath("~/Upload");  //由虚拟路径指定的服务器上的物理路径
            string filePath1 = System.Web.HttpContext.Current.Server.MapPath("~/Upload"); //对应于路径的Web服务器上的物理文件路径。
            string filePath2 = System.Web.Hosting.HostingEnvironment.MapPath("~/Upload"); //由虚拟路径指定的服务器上的物理路径

 

 

winform

var s1 = System.IO.Directory.GetCurrentDirectory(); //D:\abc\bin\Debug
string s2 = System.Windows.Forms.Application.StartupPath; //D:\abc\bin\Debug
string s3 = System.AppDomain.CurrentDomain.BaseDirectory; //D:\abc\Debug\

转载于:https://www.cnblogs.com/enych/p/9441312.html

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- huatuo9.cn 版权所有 赣ICP备2023008801号-1

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务