Can I remove unwanted http headers Server, X-AspNet-Version and X-AspNetMvc-Version using global.asax?
06:03 12 Jun 2019

I have used the following code shown below. This removes the headers but is this the right way to do it? Should I go for another approach as many posts suggest?

I have added this code and it removes the unwanted headers but I'm new to handling these headers. Want to know if this is how it is done.

    protected void Application_PreSendRequestHeaders()
    {
        Response.Headers.Remove("Server");
        Response.Headers.Remove("X-AspNet-Version");
        Response.Headers.Remove("X-AspNetMvc-Version");
    }

-

asp.net-mvc global-asax