IIS中发布网站可以下载根目录外面的文件吗?
因为文件很大,而且在别的盘上,没有办法拷贝到发布的网站根目录下面,不知道有没有办法访问根目录外面目录中的文件,或者有没有什么替代办法。
[解决办法]
建个二级域名 file.xx.com 目录指向文件盘
file.xx.com/filename.rar 这样下载?
========================
NET下载输出好像是绝对路径啊 不能下载吗?
FileInfo fi = new FileInfo(destFileName);
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.ClearHeaders();
HttpContext.Current.Response.Buffer = false;
if (filename == String.Empty)
HttpContext.Current.Response.AppendHeader("Content-Disposition",
"attachment;filename=" + Path.GetFileName(destFileName));
else
HttpContext.Current.Response.AppendHeader("Content-Disposition",
"attachment;filename=" + filename + UtilsFile.GetFileType(destFileName));
HttpContext.Current.Response.AppendHeader("Content-Length", fi.Length.ToString());
HttpContext.Current.Response.ContentType = "application/octet-stream";
HttpContext.Current.Response.WriteFile(fi.FullName);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();