Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
shyambhiogade opened this issue Aug 15, 2020 · 2 comments

Comments

@shyambhiogade
Copy link

shyambhiogade commented Aug 15, 2020

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
Copy link
Author

@ScottHelme can you please comment on this.

@shyambhiogade
Copy link
Author

@ScottHelme please help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant