AutoEventWireup
uses reflection searching page methods by page_eventName
When AutoEventWireup is true, handlers are automatically bound to events at run time based on their name and signature. For each event, ASP.NET searches for a method that is named according to the pattern Page_eventname, such as Page_Load or Page_Init.
Question :
Does he do it for every request ?
I looked in the temporary internet files
(at Microsoft.net
folder...) to see if he saves another file which contains explicit handler attachment - and couldn't find any .
It seems that ASP.NET uses cache for that as @Marc said. See internal
TemplateControl.HookUpAutomaticHandlers
.A part of this method by using dotPeek:
Private
GetDelegateInformation
method is responsible for creating delegates for the control.TemplateControl._eventListCache
is aHashtable
which holds delegates per template control.So, answering your question:
The answer is no. ASP.NET does it once to populate this
Hashtable
, and then uses cached values.