读书人

对途径“C:Inetpubwwwrootnutideimage

发布时间: 2013-10-16 11:29:46 作者: rapoo

对路径“C:Inetpubwwwrootnutideimagespics6662.gif”的访问被拒绝
对路径“C:Inetpubwwwrootnutideimagespics6662.gif”的访问被拒绝
我后台是这么写的 为什么他会把我的\号都给弄没了啊?
string path = Server.MapPath("~");
string folder = "images\\LmImg\\";
string filename = FileUpload1.FileName;
FileUpload1.SaveAs(path + folder + filename);
[解决办法]
string folder = System.Web.HttpContext.Current.Server.MapPath("/") + "/images/LmImg".Replace("/", "\\") + "\\";

你为什么要替换呢?

string folder = System.Web.HttpContext.Current.Server.MapPath("~/") + "/images/LmImg/";

读书人网 >asp.net

热点推荐