dotnet core 5.0 with appedheaders(“ content-disposition”)不起作用
我正在尝试通过访问内容分配来从文件上传中检索文件名。
在我的配置方法中,我拥有的配置服务
// enable cors
services.AddCors(opt =>
{
opt.AddPolicy("CorsPolicy", policy =>
{
policy
.WithOrigins("http://localhost:3000")
.AllowAnyHeader()
.WithExposedHeaders("content-disposition")
.AllowAnyMethod()
.AllowCredentials()
.SetIsOriginAllowedToAllowWildcardSubdomains();
});
});
。
// enable cors
app.UseCors("CorsPolicy");
在我只收到的响应标题中。
headers:
content-length: "21"
content-type: "application/json; charset=utf-8"
我还必须检查/更改才能工作?
I am trying to retrieve the filename from a file upload by accessing the content-disposition.
In my ConfigureServices I have
// enable cors
services.AddCors(opt =>
{
opt.AddPolicy("CorsPolicy", policy =>
{
policy
.WithOrigins("http://localhost:3000")
.AllowAnyHeader()
.WithExposedHeaders("content-disposition")
.AllowAnyMethod()
.AllowCredentials()
.SetIsOriginAllowedToAllowWildcardSubdomains();
});
});
In my Configure method I have.
// enable cors
app.UseCors("CorsPolicy");
In the response headers I only receive.
headers:
content-length: "21"
content-type: "application/json; charset=utf-8"
What else do I have to check/change in order for this to work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论