X-FRAME-Options
Add this code in global.asax file.
protected void Application_BeginRequest(object sender, EventArgs e)
{
HttpContext.Current.Response.AddHeader("x-frame-options", "DENY");
}
OR
simply add this to <system.webServer>
in your Web.Config file
<!--Clickjacking security-->
<httpProtocol>
<customHeaders>
<add name="X-Frame-Options" value="DENY" />
</customHeaders>
</httpProtocol>
<!--End clickjacking-->
This small snippet adds a http header called x-frame-options to your http responses and prevents your site being loaded in an iframe in “modern” browsers.
There are 3 values possible to X-Frame-Options:
- DENY: do not allow any site to frame your application
- SAMEORIGIN: only allow same application site to frame
- ALLOW-FROM: only allow specific domain to frame your application