Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to integrate axd (Elmah) as component in ASP.NET MVC site

I have Elmah up and running in my ASP.NET MVC site and I would like to integrate its interface with the administration pages of the site. By default, you invoke the interface with the url ~/elmah.axd, which runs outside the MVC system. The installation requires you to tell MVC to ignore the route, so there's no controller or anything that knows about elmah. The installation suggest a specific ignore, even though it is already ignored by default:

public class MvcApplication : System.Web.HttpApplication {
    public static void RegisterRoutes(RouteCollection routes) {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
        routes.IgnoreRoute("elmah.axd");
...
}

I would like to try integrating elmah.axd as a component of the site. I'm thinking to have a Elmah controller with a view that uses the Futures helper Html.RenderRoute but I'm not sure what arguments to pass:

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2>Elmah</h2>
    <% Html.RenderRoute(???); %>
</asp:Content>

Does this make sense - is there a way to pass the url in to Html.RenderRoute? Is there a better way that doesn't use Html.RenderRoute?

like image 267
keithm Avatar asked Jul 06 '09 11:07

keithm


2 Answers

Try this in your View instead:

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2>Elmah</h2>
    <iframe src="<%= Url.Content("~/elmah.axd") %>" frameborder=no width=100% scrolling=auto>
    </iframe>
</asp:Content>
like image 104
eu-ge-ne Avatar answered Sep 22 '22 07:09

eu-ge-ne


or you can use this on your site

Elmah Error Log Application

like image 26
Vijayant Katyal Avatar answered Sep 20 '22 07:09

Vijayant Katyal