securityheaders / securityheaders-bugs

Bug tracker for https://securityheaders.io
20 stars 0 forks source link

SecureHeader site shows header missing if i add the header through code instead of web.config file #84

Open shyambhiogade opened 4 years ago

shyambhiogade commented 4 years ago

hi, My site has x-frame-option as deny, its set through aspnet code with custom attribute. i could see the header in the responce in chrome developer tools but the secure header site is still reporting as its missing header. can you please tell me why.

image

headers from the response in chrome developer tool.

image

and here is the code that sets it from aspnet

     /// <summary>
    /// This class is used to handle X-FRAME-OPTIONS
    /// </summary>
    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
    public sealed class CustomActionFilterAttribute : ActionFilterAttribute
    {     
        public override void OnResultExecuting(ResultExecutingContext filterContext)
        {
            if (filterContext != null)
            {

                    filterContext.HttpContext.Response.Headers.Add("x-frame-options", "deny");

            }

            base.OnResultExecuting(filterContext);
        }
    }

Please tell me why it does not detect, is there anything wrong.

shyambhiogade commented 4 years ago

@ScottHelme can you please comment on this.

shyambhiogade commented 4 years ago

@ScottHelme please help.