ASP. NET pipeline Optimization

Source: Internet
Author: User

ASP. NET pipeline Optimization

Many ASP. NET default HttpModules in the request pipeline are used to intercept each request sent by the client. For example, SessionStateModule intercepts each request, parses the corresponding session cookie, and loads the appropriate session in HttpContext. Real-time proof, not all modules are necessary.

For example, if you do not use the Membership and Profile provider providers, you do not need the FormsAuthentication module. If you need to use Windows verification for your users, you do not need WindowsAuthentication. These modules in the pipeline only execute unnecessary code when each request arrives.

The default modules are defined in the $ WINDOWS $ \ Microsoft. NET \ Framework \ $ VERSION $ \ config directory in the machine. CONFIG file ).

 
 
  1. <httpModules> 
  2. <add name="OutputCache" type="System.Web.Caching.OutputCacheModule" /> 
  3. <add name="Session" type="System.Web.SessionState.SessionStateModule" /> 
  4. <add name="WindowsAuthentication" 
  5. type="System.Web.Security.WindowsAuthenticationModule" /> 
  6. <add name="FormsAuthentication" 
  7. type="System.Web.Security.FormsAuthenticationModule" /> 
  8. <add name="PassportAuthentication" 
  9. type="System.Web.Security.PassportAuthenticationModule" /> 
  10. <add name="UrlAuthorization" type="System.Web.Security.UrlAuthorizationModule" /> 
  11. <add name="FileAuthorization" type="System.Web.Security.FileAuthorizationModule" /> 
  12. <add name="ErrorHandlerModule" type="System.Web.Mobile.ErrorHandlerModule,  
  13. System.Web.Mobile, Version=1.0.5000.0,  
  14. Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> 
  15. </httpModules> 

You can add <remove> nodes to your website application in the web. config file to delete these default modules. The ASP. NET pipeline optimization code is as follows:

 
 
  1. <httpModules> 
  2.  <!-- Remove unnecessary Http Modules for faster pipeline --> 
  3.  <remove name="Session" /> 
  4.  <remove name="WindowsAuthentication" /> 
  5.  <remove name="PassportAuthentication" /> 
  6.  <remove name="AnonymousIdentification" /> 
  7.  <remove name="UrlAuthorization" /> 
  8.  <remove name="FileAuthorization" /> 
  9. </httpModules> 


The above configuration is very suitable for websites that use databases and are verified based on Forms. They do not require any session support. Therefore, all these modules can be safely deleted. The above introduces ASP. NET pipeline Optimization

  1. Analysis of configuration files in ASP. NET
  2. . Net ria Services is as convenient as ASP. NET
  3. Overview of the UpdatePanel control in ASP. net ajax Extensions
  4. ASP. NET calls the UpdatePanel Update () method
  5. Introduction to the ASP. net ajax wcf Service

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.