网站上加了一个功能,用了一个SharpZipLib,让用户把网站上的图片打包下载。我在本地运行时可以啊,可是挂到网上去就不行了啊。temp我用代码建的一个文件夹:
[code=C#]
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
string image = ds.Tables[0].Rows[i][0].ToString();
string pname = ds.Tables[0].Rows[i][1].ToString();
if (!Directory.Exists("temp/" + pname))
{
Directory.CreateDirectory("temp/" + pname);
}
File.Copy(Server.MapPath("~/products/") + image, Server.MapPath("~/temp/" + pname + "/") + image);
}
string fileName = cname + "_" + DateTime.Now.Year + "_" + DateTime.Now.Month + "_" + DateTime.Now.Day.ToString() + "_" + DateTime.Now.Hour.ToString();
dlZipDir(Server.MapPath("~/temp"), fileName);
code]
是不是在网上没有权限的问题啊,
[code=C#]
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
string image = ds.Tables[0].Rows[i][0].ToString();
string pname = ds.Tables[0].Rows[i][1].ToString();
if (!Directory.Exists("temp/" + pname))
{
Directory.CreateDirectory("temp/" + pname);
}
File.Copy(Server.MapPath("~/products/") + image, Server.MapPath("~/temp/" + pname + "/") + image);
}
string fileName = cname + "_" + DateTime.Now.Year + "_" + DateTime.Now.Month + "_" + DateTime.Now.Day.ToString() + "_" + DateTime.Now.Hour.ToString();
dlZipDir(Server.MapPath("~/temp"), fileName);
code]
是不是在网上没有权限的问题啊,
解决方案 »
- Ajax Control Toolkit在VS2010中如何使用?拖拽没有反应啊
- 求EXCEL导出
- VISTA中装不了SQL2000啊?急。。。。
- asp.net 数据查询
- 自由浮动的QQ在线客服
- 七招制胜ASP.NET应用程序开发
- 希望看过WROX《ASP.NET Website Programming Problem-Design-Solution 1.0》的朋友指教!在线等啊等。。。!
- System.Web.Mail的问题
- 新建项目时的错误
- public static string 失效的问题
- asp.net repeater怎么用啊?
- 无法打开登录所请求的数据库 "liveportal"。登录失败。用户 'sa' 登录失败。
("temp/" + pname
不是一个路径。
难道是没有权限建文件夹么?