Removing headers from the response

前端 未结 4 1131
予麋鹿
予麋鹿 2021-01-11 11:52

I need to cloak certain headers generated by ASP.NET and IIS and returned in the responses from a ASP.NET WebAPI service. The headers I need to cloak are:

  • Serv
4条回答
  •  甜味超标
    2021-01-11 12:15

    The problem is each one is added at a different point:

    • Server: added by IIS. Not exactly sure if it can be turned off although you seem to have been to remove it using HttpModule .
    • X-AspNet-Version: added by System.Web.dll at the time of Flush in HttpResponse class
    • X-AspNetMvc-Version: Added by MvcHandler in System.Web.dll. It can be overridden so this one should be OK.
    • X-Powered-By by IIS but can be turned off as you said.

    I think your best bet is still using HttpModules.

提交回复
热议问题