创建网页下载 [英] Creat webpage download
本文介绍了创建网页下载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,请告诉我如何创建网页来下载文档或文件Win zip或doc文件
非常感谢您
解决方案
我正在创建一个有关学习的网站,我使用C#和asp.net语言
Hi everybody,could show tell me how to creat webpage to download document or file win zip, or doc file
Thank you very much
解决方案
I am creating a website about learning, I use language C# and asp.net
// Button click event. protected void Button1_Click(object sender, ImageClickEventArgs e) { string FullFilePath = "D:\\madhu\\doc\\ASP.doc"; //filepath FileInfo file = new FileInfo(FullFilePath); if (file.Exists) { // for document Response.ContentType = "application/vnd.ms-word"; // for Zip Response.ContentType = "application/zip"; Response.AddHeader("Content-Disposition", "inline; filename=\"" + file.Name + "\""); Response.AddHeader("Content-Length", file.Length.ToString()); Response.TransmitFile(file.FullName); } }
这篇关于创建网页下载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文