读书人

Server.MapPath路径有关问题

发布时间: 2013-02-03 12:33:31 作者: rapoo

Server.MapPath路径问题
string _filedir = Server.MapPath("192.168.0.222/E:/upload");
报错
不支持给定路径的格式。
E:\upload 在192.168.0.222是存在的 路径问题
[解决办法]
MapPath:

eturns the physical file path that corresponds to the specified virtual path on the Web server.

你的路径是virtual path on the Web server.吗?
[解决办法]
共享 192.168.0.222 下 E:/upload --> Upload,当然设置好授权

然后程式直接访问 string _filedir = "\\192.168.0.222\Upload"

不需要使用Server.MapPath

读书人网 >C#

热点推荐