c# - 无法点击 Gmail 中的下载链接
问题描述
我的服务创建了一封发送给用户的电子邮件。在电子邮件中,有一个指向我的服务的链接,用于下载文件。
- 当我单击 Gmail 中的链接时,会调用该服务,但下载/生成的文件不会开始下载。
- 当我右键单击->复制网址->粘贴到新选项卡时,它会下载。
- 当我将电子邮件转发到 Outlook 客户端时,它会在我单击链接时起作用。
电子邮件的正文如下所示:
Click to <a href=http://localhost:1234/download?token=mytoken target="_blank">download</a>
带引号:
Click to <a href="http://localhost:1234/download?token=mytoken" target="_blank">register</a>
我在端点上的控制器如下所示:
[HttpGet]
[AllowAnonymous]
public ActionResult Get(string token)
{
...
var result = new FileContentResult(System.IO.File.ReadAllBytes("mypath"), "application/exe")
{
FileDownloadName = "myFile.msi"
};
return result;
}
解决方案
推荐阅读
- python - 熊猫填补缺失的时间序列数据
- python - 如果值为真,则将布尔值替换为 df 列的名称 Pandas
- python - 将 matplotlib 3D 图形的框架更改为 x、y 和 z 箭头
- ios - 如何删除 Firestore 分页中使用的 addSnapshotListener 的侦听器?
- excel - 从另一个工作表中查找值并将结果粘贴为值
- nginx - NGINX 删除 .html 扩展名(重复 - 无法正常工作)
- haskell - 为什么我只能在类型参数位置传递部分应用的类型构造函数?
- excel - Excel VBA 将一个工作表上的列中的单元格与另一工作表中的列中的单元格进行比较,如果匹配复制行
- python - 将 TIFF 图像转换为 XY 坐标
- rust - 如何为 gstreamer 源元素插件同时支持 MP3 和 WAV