Browse Source

Remove unnecessary HTTP response headers

This removes:

X-AspNetMvc-Version: 4.0
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET

I didn't see any performance improvement, but this is probably a good idea
in case the extra bytes cause another network packet to be needed,
compared to other frameworks.
Malcolm Evershed 12 years ago
parent
commit
6350570698
3 changed files with 7 additions and 0 deletions
  1. 2 0
      aspnet/src/Application.cs
  2. 2 0
      aspnet/src/Web.config
  3. 3 0
      installer.ps1

+ 2 - 0
aspnet/src/Application.cs

@@ -23,6 +23,8 @@ namespace Benchmarks.AspNet
 
 
         private void Start()
         private void Start()
         {
         {
+            // Remove X-AspNetMvc-Version HTTP response header
+            MvcHandler.DisableMvcResponseHeader = true;
             Routes();
             Routes();
             Views();
             Views();
         }
         }

+ 2 - 0
aspnet/src/Web.config

@@ -26,6 +26,8 @@
     </providers>
     </providers>
   </entityFramework>
   </entityFramework>
   <system.web>
   <system.web>
+    <!-- Remove X-AspNet-Version HTTP response header -->
+    <httpRuntime enableVersionHeader="false" />
     <!-- Show errors -->
     <!-- Show errors -->
     <customErrors mode="Off"/>
     <customErrors mode="Off"/>
   </system.web>
   </system.web>

+ 3 - 0
installer.ps1

@@ -26,6 +26,9 @@ appcmd set config -section:system.webServer/httpErrors -errorMode:Detailed | Out
 # Disable logging
 # Disable logging
 appcmd set config -section:system.webServer/httpLogging -dontLog:True | Out-Null
 appcmd set config -section:system.webServer/httpLogging -dontLog:True | Out-Null
 
 
+# Remove unnecessary X-Powered-By HTTP response header
+appcmd set config -section:system.webServer/httpProtocol /-"customHeaders.[name='X-Powered-By']" | Out-Null
+
 # URL Rewrite
 # URL Rewrite
 $rewrite_url = "http://download.microsoft.com/download/6/7/D/67D80164-7DD0-48AF-86E3-DE7A182D6815/rewrite_2.0_rtw_x64.msi"
 $rewrite_url = "http://download.microsoft.com/download/6/7/D/67D80164-7DD0-48AF-86E3-DE7A182D6815/rewrite_2.0_rtw_x64.msi"
 $rewrite_local = "$workdir\rewrite_2.0_rtw_x64.msi"
 $rewrite_local = "$workdir\rewrite_2.0_rtw_x64.msi"