Between handling the Page_Init event or overriding the OnInit method of a Page, which one is better to use? Thanks.
Overriding the base type's method is preferable as a virtual call is simpler and cleaner than creating a delegate attaching an event to a method group.
Also, relying on AutoEventWireup
being set to true
means that you are introducing overhead into the parsing of your page code as ASP.NET will have to create any delegates for you at execution-time.