如何从我的桌面.net核心下载文件? [英] how to download a file from my desktop .net core?
本文介绍了如何从我的桌面.net核心下载文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
经过长时间的网上搜索后,我没有找到解决方案,当我单击文档开始在浏览器中下载文件时,该怎么办?我需要在我的应用程序.net核心中
after a long search on the net I did not find a solution how I can do when I click on a document starts its download in the browser ,I need this in my application .net core
推荐答案
您只需要:
首先,设置您的回复哑剧类型:
first, set your response mime type:
Response.Headers.Add("Content-Type", "application/pdf"); //for example
秒,将以下标头设置为指示浏览器下载文件:
second, set following header as a dictate to browsers to download file:
Response.Headers.Add("Content-Disposition", "attachment; filename=foo.pdf"); //for example
这篇关于如何从我的桌面.net核心下载文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文