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

iis问题

--------------------编程问答-------------------- 是否具有文件夹操作权限,使用相对路径
--------------------编程问答-------------------- FileStream fs = new FileStream("d:/nopicture.jpg", FileMode.Open);
服务器上d:/nopicture.jpg图片路径存在吗?
应该用Server.MapPath径吧 --------------------编程问答-------------------- 文件存在 --------------------编程问答-------------------- d:/nopicture.jpg", 

不能这样用路径,应该用Server.MapPath,并放到iis发布目录里。 --------------------编程问答--------------------
FileStream fs = new FileStream(Server.MapPath("../stylesheet/images/nopicture.jpg"), FileMode.Open);
int imageSize =(int) fs.Length;
byte[] imageContent = new byte[imageSize];
fs.Read(imageContent, 0, imageSize);
Response.ContentType = "application/octet-stream";
Response.BinaryWrite(imageContent);


改成这样也不行
--------------------编程问答-------------------- 检查路径和权限 --------------------编程问答-------------------- 路径问题
d:/nopicture.jpg" 说明你在本地测试的时候D盘有这个图片
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,