autoeventwireup performance cost

后端 未结 4 1166
情书的邮戳
情书的邮戳 2021-01-12 10:35

I have been looking at improving my asp.net page performance, is it worth changing autoeventwireup from true to false and adding the event handlers or is the performance pen

4条回答
  •  不思量自难忘°
    2021-01-12 11:10

    From MSDN article.

    Performance Tips and Tricks in .NET Applications

    Avoid the Autoeventwireup Feature

    Instead of relying on autoeventwireup, override the events from Page. For example, instead of writing a Page_Load() method, try overloading the public void OnLoad() method. This allows the run time from having to do a CreateDelegate() for every page.

    Knowledge Base article:

    How to use the AutoEventWireup attribute in an ASP.NET Web Form by using Visual C# .NET

    When to avoid setting the value of the AutoEventWireup attribute to true

    If performance is a key consideration, do not set the value of the AutoEventWireup attribute to true. The AutoEventWireup attribute requires the ASP.NET page framework to make a call to the CreateDelegate function for every ASP.NET Web Form page. Instead of using automatic hookup, you must manually override the events from the page.

提交回复
热议问题