https://msdn.microsoft.com/en-us/library/system.web.helpers.antiforgeryconfig.suppressxframeoptionsheader(v=vs.111).aspx
ClickJacking을 방지하는 데 사용되는 X-Frame-Options 헤더 생성을 억제할지 여부를 지정합니다. 기본적으로 X-Frame-Options 헤더는 SAMEORIGIN 값으로 생성됩니다. 이 설정이 'true'이면 응답에 대해 X-Frame-Options 헤더가 생성되지 않습니다.
Global.asax.cs
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
GlobalConfiguration.Configure(WebApiConfig.Register);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
//외부에 iframe 호출 가능케 함.!!! web.config 처리 가능하지만 서브메뉴 들어가면 다시 원상복구됨 ㅡㅡ;
// 어쩔수 없이 이거 넣어야 함 written by luckshim
System.Web.Helpers.AntiForgeryConfig.SuppressXFrameOptionsHeader = true;
}
web.config 에서 이를 삭제하기 위해 customHeader 를 아래와 같이 설정이 가능하지만, 메인 경로는 상관없는데 서브메뉴 들어가면 다시 활성화 됩니다. 따라서 위와 같이 c# 으로 SuppressXFrameOptionsHeader 를 true 설정해 줘야 합니다.
<system.webServer>
<httpProtocol>
<customHeaders>
<remove name="X-Frame-Options" />
</customHeaders>
</httpProtocol>
</system.webServer>
출처: http://aspdotnet.tistory.com/1960 [심재운 블로그]
첫댓글 위 옵션을 꺼야 할 상황이 혹시 있을까요?
외부에서 해당 사이트 접속을 차단하고자 할 경우 그대로 두시면 되고 , 외부에 스크립트로 접속을 허용해 줄 상황이 생기면 사용이 될 수 있습니다.