下载的问题。
一般做下载,就是用一个链接到你要下载的文件,可是如果你要下载的文件是图片或网页,那么就直接到开了,而不是下载,
怎么样让他不打开,点击就下载。 --------------------编程问答-------------------- ffffff --------------------编程问答-------------------- fdggg --------------------编程问答-------------------- //文件普通下载
string path=Server.MapPath("广告.jpg");
string filename = "广告.jpg";
System.IO.FileInfo toDownload = new System.IO.FileInfo(path);
Response.Clear();
if (System.IO.Path.GetExtension(filename) == ".jpg")
{
Response.AddHeader("Content-Disposition", "attachment;filename=NEW_" + HttpUtility.UrlEncode(toDownload.Name));
Response.ContentType = "application/x-zip-compressed";
Response.TransmitFile(path);//需要安装.net framework sp1
Response.End();
} --------------------编程问答-------------------- string path=Server.MapPath( "广告.jpg ");
string filename = "广告.jpg ";
System.IO.FileInfo toDownload = new System.IO.FileInfo(path);
Response.Clear();
if (System.IO.Path.GetExtension(filename) == ".jpg ")
{
Response.AddHeader( "Content-Disposition ", "attachment;filename=NEW_ " + HttpUtility.UrlEncode(toDownload.Name));
Response.ContentType = "application/x-zip-compressed ";
Response.TransmitFile(path);//需要安装.net framework sp1
Response.End();
}
补充:.NET技术 , ASP.NET