Installation and deployment Questions on installation, system configuration and deployment to the live server.
Version 6.x > Installation and deployment > Where best to customize HttpApplication? View modes: 
User avatar
Member
Member
bdrenner-new42 - 10/23/2013 9:17:59 AM
   
Where best to customize HttpApplication?
I can see three points at which I could add custom code for Kentico's HttpApplication:

- Global.asax.cs
- CMSHttpApplication.cs
- CMSAppBase.cs

I had some trouble adding to the usual Global.asax.cs. Application_Start would never fire, and for every exception, Application_Error would fire twice.

I've settled on modifying Kentico's provided CMSHttpApplication.cs, but it doesn't feel right. What is the best practice for adding custom code to the typical HttpApplication methods?

User avatar
Kentico Customer Success
Kentico Customer Success
kentico_martind2 - 10/26/2013 5:13:02 PM
   
RE:Where best to customize HttpApplication?
Hello,

I would recommend you to use the Global events.

Especially in your case would be helpful:
CMSApplicationEvents – contains events related to the whole application run.

-> Start – fired when the application starts. It is recommended to bind only the After handler to make sure you handler has all necessary data initialized.

and

SystemEvents - contains general system events, replaces the old CustomExceptionHandler.

-> Exception - fired when unhandled exception occurs.

Best regards,
Martin Danko

User avatar
Member
Member
bdrenner-new42 - 10/28/2013 9:23:37 AM
   
RE:Where best to customize HttpApplication?
Thanks. That's exactly what I needed.