文件下载问题 [英] File Downloading Problem
本文介绍了文件下载问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我以前使用此代码下载文件.
I previously use this code to download a file.
<asp:HyperLink ID="HyperLink6" runat="server" NavigateUrl='<%# "~/uploads/"+Eval("Name") %>' Text='<%# Eval("Name") %>'>
现在我想在按钮单击上做同样的事情,所以我做了这样的事情.
and now i wanna do the same on button click so i did something like this.
protected void Button1_Click(object sender, EventArgs e)
{
Response.Write( "~/uploads/"+"Name" );
}
didn''t work for me what should i do?
推荐答案
在纯HTML + JavaScript中可以这么简单:
It can be as simple as that, in pure HTML + JavaScript:
<input type="button" onclick="location='myfile.zip'" value="Download..." />
尝试以下方法:
使用C#在ASP.Net中下载文件 [下载文件-强制文件下载对话框 [ ^ ]
使用asp.net和C#下载文件 [
Try these:
File downloading in ASP.Net using C#[^]
Downloading Files - Forcing the File Download Dialog[^]
Downloading file using asp.net and C#[^]
hope it helps :)
这篇关于文件下载问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文