当前位置:编程学习 > C#/ASP.NET >>

Server.MapPath路径问题

string path = Server.MapPath("/upfile/") + fileName; --------------------编程问答-------------------- 未能映射路径  是什么原因 --------------------编程问答-------------------- string path = @Server.MapPath("upfile/") + fileName; --------------------编程问答-------------------- Server.MapPath("/upfile") --------------------编程问答-------------------- 原因:估计是把 /upfile 当成转义字符了。

你试一下楼上说得方法:string path = @Server.MapPath("upfile/") + fileName; --------------------编程问答-------------------- string path = Server.MapPath("upfile") + fileName;
这样就行了。 --------------------编程问答-------------------- 不要用server.mappath --------------------编程问答--------------------

string dir="upload/";
string serverPath = HttpContext.Current.Server.MapPath("~/"+dir);//服务器的物理路径,注意~/

--------------------编程问答-------------------- 楼上正解
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,