2013-04-04 76 views
0

我尝试使用以下来访问本地主机上的目录,但错误显示路径格式不受支持。路径格式错误

 string fileName=ImageName.ToString() + ".Jpeg"; 
    bmp.Save(System.IO.Path.Combine("localhost:59657/ProfileTenModified/setP/", fileName), System.Drawing.Imaging.ImageFormat.Jpeg); 

任何解决方案???

+4

你不需要使用'Server.MapPath' ..吗? – MethodMan 2013-04-04 16:28:26

+0

什么类型的对象是“bmp”? – jadarnel27 2013-04-04 16:28:43

回答

1

.net中的IO操作需要文件系统的绝对路径。您不能对具有域名的文件或目录进行操作。正如DJ KRAZE所说,改为使用

Server.MapPath("~/ProfileTenModified/setP/" + fileName) 
+0

谢谢...... :) – spiral 2013-04-04 16:44:21