簡體   English   中英

從Intranet上經過身份驗證的服務器中檢索文件,然后將其發送到客戶端

[英]Retrieve a file from an authenticated server on intranet and server it to the client

我目前正在使用MVC在本地構建我的項目。

用戶輸入一些搜索信息,並獲得一個鏈接,以下載網絡上其他地方存在的Vox格式的文件。

該其他服務器具有共享驅動器和身份驗證。

我需要讓我的控制器抓取該文件並將其吐出到客戶端進行下載。

最好的方法是什么?

謝謝!

最好的方法是什么?

通過公開返回FileResult的控制器操作:

public ActionResult Download()
{
    byte[] file = ... go and fetch the file contents from wherever it is stored
    return File(file, "some MIME type", "filename.someextension");
}

然后在您的視圖內部提供指向用戶的鏈接,以便他可以下載:

@Html.ActionLink("download the Vox file", "Download")

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM