Test error logging with ELMAH

To ensure that you have configured error logging with ELMAH successfully, perform the following:

  1. Open your Sitefinity CMS project in Visual Studio.
  2. In the context menu of the Solution Explorer, click to Add new » Web Form.
  3. Name the new web form ELMAH.
  4. To throw new application exception, open the code-behind on the web form and add the following code in the Page_Load:
  5. Build the application, run it in the browser, and navigate to http://www.yoursite.com/elmah.axd.
    You are prompted to log in before you see the content. After a successful authentication, you see a web page to remotely view the entire log of recorded exceptions.

    NOTE: Only administrators can see the page, other roles and unauthenticated users will get a 403 error.

  6. To throw a new exception, navigate to http://www.yoursite.com/ELMAH.aspx.
    The following error appears:


    Once you get the exception, you must receive a new email in smtp4dev.
    The email contains detailed information about the origin of the exception and the stack trace.

  7. To view the full details of a logged exception, navigate one more time to http://www.yoursite.com/elmah.axd.
    The following error log appears. It has default and detailed views.

    Default view

    Detailed view

Every exception in Sitefinity CMS is tracked and logged by ELMAH. 
For more information, see ELMAH - Error Logging Modules And Handlers.

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Get started with Integration Hub | Sitefinity Cloud | Sitefinity SaaS

This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.

Web Security for Sitefinity Administrators

This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?