在ASP.NET和ASP.NET Core中禁用访问控制
我们刚刚进行了外部笔测试,我们所有的网站都回来了,警告说我们允许跨站点脚本。 我认为实际上并非如此,因为我们必须在一个特定站点的一个页面上专门允许它才能工作。
该报告表明,当调用我们的URL是访问控制的标题时,设置为 *。 使用邮递员,我可以得到相同的结果。
这两个ASP.NET Web表单应用程序以及新的ASP.NET 6 Razor Page Apps都返回了相同的结果。 有什么办法可以删除此标头? 也许是IIS中的东西?
We just had an external pen test and all of our sites are coming back with a low warning stating that we allow cross site scripting.
I don't think this is actually the case since we had to specifically allow it on one page on one specific site for that one to work.
The report shows that when calling our URL's a header for Access-Control-Allow-Origin is set to *.
Using Postman I can get that same result.
This is returning the same result from both ASP.Net web forms applications as well as new ASP.Net 6 Razor page apps.
Is there any way to have this header removed?
Maybe something in IIS?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要摆脱它,您必须列出所有允许将请求发送到您的端点的起源。如果您正在运行ASP.NET Core应用程序,则必须以这样的方式配置CORS中间件:
对于您的Web表单应用程序,您可以安装IIS CORS模块并在
web.config
文件中进行配置。To get rid of it you have to list all the origins that are allowed to send the requests to your endpoint. If you are running ASP.NET Core application then you have to configure the CORS middleware like this:
For your Web Forms application you can install IIS CORS module and configure it in the
web.config
file like this: