Logging to elmah.io from Sitefinity
Sitefinity is a CMS from Telerik, implemented on top of ASP.NET. Like other content management systems build on top of ASP.NET, ELMAH is supported out of the box.
To install elmah.io in a Sitefinity website, start by opening the website in Visual Studio by selecting File | Open Web Site... and navigate to the Sitefinity projects folder (something similar to this: C:\Program Files (x86)\Telerik\Sitefinity\Projects\Default
).
Right-click the website and install the Elmah.Io
NuGet package:
Install-Package Elmah.Io
dotnet add package Elmah.Io
<PackageReference Include="Elmah.Io" Version="5.*" />
paket add Elmah.Io
During installation, you will be prompted for your API key (Where is my API key?) and log ID (Where is my log ID?).
That's it! Uncaught errors in Sitefinity are logged to your elmah.io log. To test that the integration works, right-click the website and add a new Web Form named ELMAH.aspx. In the code-behind file add the following code:
protected void Page_Load(object sender, EventArgs e)
{
throw new ApplicationException();
}
Start the website and navigate to the ELMAH.aspx page. If everything works as intended, you will see the yellow screen of death, and a new error will pop up on elmah.io.
Troubleshooting
Config section 'system.webServer/validation' already defined
In case you see an Internal Server Error with the Config error above when launching the site, it means that changes to the web.config
file are required. Open the web.config
file and search for validateIntegratedModeConfiguration
. This attribute may be found on multiple <validation>
elements. The element should only be specified in the configuration once so go ahead and remove instances bringing the total number down to one. Also, make sure to set the value of the attribute to false
:
<validation validateIntegratedModeConfiguration="false" />
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.
See how we can help you monitor your website for crashes Monitor your website