Logging to elmah.io from ASP.NET / WebForms
This article will explain the steps necessary to log errors from your web application into elmah.io. We also offer more specific guides on ASP.NET MVC, Web API, and a lot of other web- and logging-frameworks. Read through this tutorial and head over to a tutorial specific for your choice of framework afterwards.
This guide is also available as a short video tutorial here:
Create a new ASP.NET Web Application in Visual Studio :
Select a project template of your choice:
Navigate to elmah.io and login using username/password or your favorite social provider. When logged in, elmah.io redirects you to the dashboard. If you just signed up, you will be guided through the process of creating an organization and a log.
When the log has been created, elmah.io shows you the install instructions. If you are currently on the dashboard, click the gears icon on the lower right corner of the log box. Don't pay too much attention to the install steps, because the rest of this tutorial will guide you through the installation. Keep the page open in order to copy your API key and log ID at a later step:
Navigate back to your web project, right click References and select Manage NuGet Packages:
In the NuGet dialog, search for elmah.io:
elmah.io package and click Install. Input your API key and log ID in the dialog appearing during installation of the NuGet package:
You're ready to rock and roll. Either add
throw new Exception("Test"); somewhere or hit F5 and input a URL you know doesn't exist (like http://localhost:64987/notfound). To verify that the installation of elmah.io is successful, navigate back to the elmah.io dashboard and select the Search tab of your newly created log:
Congrats! Every error on your application is now logged to elmah.io.
This article was brought to you by the elmah.io team. elmah.io is the best error management system for .NET web applications. We monitor your website, alert you when errors start happening, and help you fix errors fast.