ASP .NET PreSendRequestHeaders not firing for Images

189 views Asked by At

I am trying to remove the "Server" information from HTTP response headers. I am using the following code in "PreSendRequestHeaders" of a custom HTTPModule.

    Private Shared Sub PreSendRequestHeaders(sender As Object, e As EventArgs)
       HttpContext.Current.Response.Headers.Remove("Server")
    End Sub

The server information is getting removed correctly for .aspx files. But the same information is persisted for the .js and .css files. How can we remove the server information from response headers of non aspx files

0

There are 0 answers