c# - 申请SSL证书后内容配置为空,为什么?
问题描述
我们已经实现了一些下载功能。我们在 api 端设置内容配置。通过这样做,我们的 UI 将从内容处置中获取文件名。
在我们添加 SSL 证书并将站点移动到域特定链接之前,这一切正常。
现在内容配置又回来null
了,文件null
以名称下载,没有扩展名。
下面是我们下载文件的代码。
public IActionResult DownloadFile(int ID)
{
try
{
if (ValidateUsrToken())
{
using (ExcelPackage package = BAL.DownloadFile(ID))
{
string fileName = Uri.EscapeDataString(package.File.Name);
System.Net.Mime.ContentDisposition cd = new System.Net.Mime.ContentDisposition
{
FileName = fileName,
};
Response.Headers.Add("Content-Disposition", cd.ToString());
return File(package.GetAsByteArray(), "application /vndopenxmlformats-officedocument.spreadsheetml.sheet");
}
}
else throw new NullReferenceException();
}
catch (Exception ex)
{
throw ex;
}
}
用户界面代码
const disposition = res.headers.get('content-disposition') || '';
if (disposition && disposition.indexOf('attachment') !== -1) {
const filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
const matches = filenameRegex.exec(disposition);
if (matches != null && matches[1]) {
filename = matches[1].replace(/['"]/g, '');
filename = decodeURIComponent(filename);
}
}
我们的 api & UI 是在 azure 云上实现的。
对此的任何帮助表示赞赏。
解决方案
推荐阅读
- python - Numpy直方图参数
- ios - 具有多个范围选择的 UISearchBar
- c# - UWP C#动态添加按钮并在StackPanel上组织
- java - 为什么在 AbstractQueuedSynchronize enq(final Node node) 方法中有一个 for(;;)
- python - 如果选中或悬停,则更改按钮的颜色
- java - method.invoke 是否在 java 中创建一个新线程?
- c# - 如何从 MySql 查询中提取日期的月份名称
- assembly - x64 汇编器 jmp 使用偏移量表
- java - 如何在 Windows 中运行 Java 应用程序,例如防病毒软件如何始终运行
- google-chrome - KENDO UI ANGULAR 检查 CHROME 中 POPUP 元素的样式