All articles(网络文学目录) All Pictures(图片目录) All Softwares(软件目录)

 
ASP.NET下载文件时直接弹出“另存为”对话框_[Asp.Net教程]

Writer: delv Article type: Programming skills(编程技巧) Time: 2014/1/23 3:10:44 Browse times: 345 Comment times: 0

ASP.NET下载文件时直接弹出“另存为”对话框_[Asp.Net教程]


Head photo

Go homepage
Upload pictures
Write articles

ASP.NET下载文件时直接弹出“另存为”对话框_[Asp.Net教程]

这个主题不知道已经被多少人问过多少遍了,无论是ASP.NET,还是PHP还是什么别的CGI,似乎这也算做一个“永恒”的话题了。

其实解决方案很简单(无论哪个CGI平台都是如此),只是一个header而已:
复制C#代码保存代码Response.ContentType = "image/jpeg";
Response.AppendHeader("Content-Disposition","attachment; filename=SailBig.jpg");
Response.TransmitFile( Server.MapPath("~/images/sailbig.jpg") );
Response.End();

转自【dflying】





There are 0 records,
Comment:
Must be registered users to comment(必须是注册用户才能发表评论)

Disclaimer Privacy Policy About us Site Map
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.