错误:无法映射路径('/') [英] Error: Failed to map the path ('/')
本文介绍了错误:无法映射路径('/')的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
运行代码时,在此行上出现异常错误:
Hi,
When I run the code, I get an exception error on this line:
string location=System.web.HttpContext.current.server.Mappath("/")
错误提示:
无法映射路径(''/'')
请帮我.我不知道该怎么办:((<>
谢谢
Error says:
Failed to map the path (''/'')
Please help me. I don''t know what should I do :((
Thanks
推荐答案
尝试:
Server.MapPath("~/Path"); //using '~' should work.
在ASP.Net 1.x中,Server.MapPath("..")在较早的版本中可以正常工作.
较新的版本不支持"..",建议改用〜".
In ASP.Net 1.x, Server.MapPath("..") works fine in the older versions.
The newer version does not support ".." and it is recommended to use "~" instead.
这篇关于错误:无法映射路径('/')的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文