X-Frame-Options 为 deny 报错

发布时间 2023-03-29 17:09:00作者: 孤海飞雁

 

前面还好好的,今天线上就反馈出这个问题。百度一下,就是iframe框不能返回数据,下面解决方法

 

解决方法一
//代码中添加响应头
app.Use(async (context, next) => { // Do work that can write to the Response. context.Response.Headers.Add("X-Frame-Options", "SAMEORIGIN"); await next.Invoke(); // Do logging or other work that doesn't write to the Response. });
解决方法二
在IIS 中添加响应头就行,然后应用池重启下,网页端清楚缓存解决

  

 

 

 

成功解决