使用可执行路径时出错 [英] Error while using Executable path

查看:80
本文介绍了使用可执行路径时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



尝试获取路径时出现以下错误.

我的代码如下:

 如果(!Directory.Exists(Path.GetDirectoryName(Application.ExecutablePath)+ "  \\ Daily_File"))
                Directory.CreateDirectory(Path.GetDirectoryName(Application.ExecutablePath)+ " );  pre> 


错误71``System.Web.HttpApplicationState''不包含``ExecutablePath''的定义,并且找不到扩展方法``ExecutablePath''接受类型为``System.Web.HttpApplicationState''的第一个参数(您是否缺少using指令或程序集引用?)

在此先感谢

解决方案

尝试Server.MapPath("~")HttpContext.Current.Request.PhysicalApplicationPath.ToString()


Hi ,

I am getting the below error while trying to get the path.

My code is below:

if (!Directory.Exists(Path.GetDirectoryName(Application.ExecutablePath) + "\\Daily_File"))
                Directory.CreateDirectory(Path.GetDirectoryName(Application.ExecutablePath) + "\\Daily_Files");




Error 71 ''System.Web.HttpApplicationState'' does not contain a definition for ''ExecutablePath'' and no extension method ''ExecutablePath'' accepting a first argument of type ''System.Web.HttpApplicationState'' could be found (are you missing a using directive or an assembly reference?)

Thanks in advance

解决方案

Try Server.MapPath("~") or HttpContext.Current.Request.PhysicalApplicationPath.ToString()


这篇关于使用可执行路径时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆