如何从其他网站文件夹下载文件 [英] How to download file from other website folder

查看:72
本文介绍了如何从其他网站文件夹下载文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从我的第一个网站页面下载位于我的第二个网站的Root上的上传文件夹中的文件。



我尝试了什么:



在第一个网站页面,我写了如下代码:





I want to download file located in my second website's "Uploads" folder under Root from my first website page.

What I have tried:

In first website page i have written code like :


protected void DownloadClick(object sender, EventArgs e)
{ 
string secondWebsitelURL = "http:\\secondWebsite\\";

string FilePath = "Uploads\\myfile.pdf
Response.ContentType = "application/octet-stream";
Response.AppendHeader("Content-Disposition", "attachment; filename=" + secondWebsitelURL + Path.GetFileName(FilePath));
Response.TransmitFile(secondWebsitelURL + FilePath);
Response.End();

}



我收到错误 ---不是有效的虚拟路径

推荐答案

检查:不是有效的虚拟路径 [ ^ ],特别是解决方案2和3.
Check this: Is not a valid virtual path[^], especially solution 2 and 3.


这篇关于如何从其他网站文件夹下载文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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