0

I have deployed a web application

I wanted to remove the server information and i was able to achieve it in handlers by adding these lines in global.asax as suggested here

 protected void Application_BeginRequest(object sender, EventArgs e)
        {
            var application = sender as HttpApplication;
            if (application != null && application.Context != null)
            {
                application.Context.Response.Headers.Remove("Server");
            }

        }

Now this removes headers for XHR requests, but still i am able to find server information in the image request's response headers!! How to remove them?

Community
  • 1
  • 1
Vignesh Subramanian
  • 7,161
  • 14
  • 87
  • 150

1 Answers1

3

I found another similar question here. The leading answer was to add this to your web.config:

<system.webServer>     
  <modules runAllManagedModulesForAllRequests="true">     
   </modules>     
</system.webServer>

Take a look at all the answers here: Removing Server header from static content in IIS 7/8

Community
  • 1
  • 1
mga911
  • 1,536
  • 1
  • 16
  • 33