如何在我的本地文件夹中下载Excel文件(D)? [英] How Can I Download Excel File In My Local Folder(D)?

查看:132
本文介绍了如何在我的本地文件夹中下载Excel文件(D)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好每一个

i想在我的D文件夹中下载一个excel文件

我尝试下载它会发出以下错误



拒绝访问路径'D:\ MyFolder'。

我的片段是

Hi Every one
i want to download an excel file in my D folder
where i try ti download it gives following error

"Access to the path 'D:\MyFolder' is denied."
my snippet is

<add key="Downloads" value="D:\MyFolder"/>




string strpath = ConfigurationManager.AppSettings["Downloads"].ToString();




httpResponse.TransmitFile(strpath);





如何解决这个问题...请帮助我



How can i solve this...please help me

推荐答案

您无法将文件保存到客户端计算机,只能发送文件,用户可以选择打开文件或将其保存到自己选择的位置。您在TransmitFile中提供的参数是要在服务器上发送的Excel文件的位置。 Google为asp.net向客户端传输文件以获取正确的示例。
You can't save a file to the client machine, you can only send the file and the user gets the option to open the file or save it to a place of their choice. The parameter you supply in TransmitFile is the location of the Excel file to send on the server. Google for "asp.net transmitting files to the client" for proper examples.


请参阅 https://msdn.microsoft.com/en-us/library/12s31dhy(v = vs.110).aspx [ ^ ]。文件名必须是服务器上源文件的路径。下载开始时,用户将选择本地计算机上的目标。
See https://msdn.microsoft.com/en-us/library/12s31dhy(v=vs.110).aspx[^]. The filename must be the path to the source file on the server. The destination on the local machine will be chosen by the user when the download starts.


这篇关于如何在我的本地文件夹中下载Excel文件(D)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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