Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 MVC 4 站点,我想阻止用户在 iframe 中显示我的站点。我知道我必须在我的回复中添加X-FRAME-OPTIONS带有值的 XFO 标头,DENY但我想问一下是否有一个地方可以放这个,以便我的所有回复都发送这个。
X-FRAME-OPTIONS
DENY
对于将来需要这样做的任何人,这就是我这样做的方式
void Application_BeginRequest(object sender, EventArgs e) { Response.Headers["X-FRAME-OPTIONS"] = "DENY"; }