1

In the past, you could capture global errors in the Application_Error function of the Global.asax. But since that has been made private, and lets be honest its not best practice. Is there a way to capture that information? I don't know of anyway right now. Mvc has a pipeline for capturing errors.

When I look in Sitecore.Web.Application, I don't see Sitecore extending the Application_Error function.

enter image description here

Any thoughts on how to capture all errors on a Sitecore Web Forms application?

  • 4
    I think Application_Error wasn't made private? They made Application_Start internal, but I think you can still use Application_Error (if you want). – Gatogordo Aug 8 '17 at 9:14
  • @Gatogordo can you post this as an answer so I can mark it answered. – Chris Auer Oct 10 '17 at 21:46
1

Application_Start was made internal, but you can still use Application_Error (if you want) in a WebForms project.

Just make sure that you global.asax overrides the one from Sitecore (Sitecore.Web.Application) otherwise you'll break the site.

2

This is still possible today, I just tested and confirmed with SC8.2 update 4. You can still modify Global.asax and add Application_Error method.

However, per practically every best practice post out there, you should NOT change the files that come from Sitecore. It could impact your ability to upgrade, etc. Plus, per old Sitecore John posts there are many levels to think about exception handling: https://community.sitecore.net/technical_blogs/b/sitecorejohn_blog/posts/all-about-exception-management-with-the-sitecore-asp-net-cms

Including, as he mentions the web.config - /configuration/system.web/customErrors node.

However, based on this question: Are there any reasons to start a new Sitecore project today, using Webforms?

You should be using MVC and then using the mvc.exception pipeline.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.