服务器处理中下载的文件 [英] downlaod files from server maching

查看:71
本文介绍了服务器处理中下载的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我已经创建了Web应用程序并将其托管到服务器中,在某些事件发生时,我将在我的应用程序中创建一些文本文件,我想在用户单击按钮时下载该文本文件.

hi all i have created web application and i hosted into server, in my application i ll create some text file when certain event occurs, i want to download that text file when user click the button. how to do this

推荐答案

string strFilePath = "";//Here give your filepath
                Response.AppendHeader("Content-Disposition", "attachment; filename=" + strFilePath);
                Response.WriteFile(strFilePath);
                Response.End();


请参阅本文

http: //www.west-wind.com/weblog/posts/2007/May/21/Downloading-a-File-with-a-Save-As-Dialog-in-ASPNET [ http://stackoverflow.com/Questions/3491174/how-to-save-a-file-generated-in-server-machine-in-clients-machinemydocument [
refer this article

http://www.west-wind.com/weblog/posts/2007/May/21/Downloading-a-File-with-a-Save-As-Dialog-in-ASPNET[^]

and this thread
http://stackoverflow.com/questions/3491174/how-to-save-a-file-generated-in-server-machine-in-clients-machinemydocument[^]


请参阅此..

使用超链接下载文件 [
Please See this..

Download File Using Hyperlink[^]


这篇关于服务器处理中下载的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆