如何在页面上下载文件加载Asp.Net [英] How Can I Download File On Page Load Asp.Net
问题描述
我有一个页面Mobileview.aspx,此页面有一个iframe和bb.aspx页面在此iframe中打开。 bb.aspx有一个超链接,比如
I Have A page Mobileview.aspx and this page has an Iframe and bb.aspx page is opening in this iframe . bb.aspx has a hyperlink like
<asp:HyperLink id="hyperlink1"
NavigateUrl="download.aspx?path=D:/folder/file.jpg"
Text="Click here to download image"
Target="_blank"
runat="server"/>
当我点击这个超链接然后download.aspx在新标签中打开,我在页面加载事件中编写了下载文件的代码。这在所有桌面浏览器中运行良好但是当我在Android或Iphone浏览器中打开bb.aspx页面然后打开新标签并等待文件下载然后它会给我连接超时。图像大小不超过100 kb。任何人都可以告诉我该怎么办呢。但是在桌面浏览器中它会下载任何问题
when i click on this hyperlink then download.aspx does open in new tab and i have written code for download file in page load event. this is working fine in all desktop browsers but when i open bb.aspx page in android or Iphone browsers then new tab open and wait for file download then it will give me connection time out . the image size hardly more than 100 kb. can anybody tell me what should i do for this.But in desktop browsers it will download file with out any issue
推荐答案
使用
Response.TransmitFile("Path");
>
这篇关于如何在页面上下载文件加载Asp.Net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!