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

2

7

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?

Strawworm answered 6/7, 2009 at 11:34 Comment(0)
I
7

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>
Ivy answered 6/7, 2009 at 11:51 Comment(1)
Thanks for this - iframe works great. I got so caught up in controllers n stuff that I forgot about straight HTML.Strawworm
P
1

or you can use this on your site

Elmah Error Log Application

Plutonian answered 12/10, 2012 at 12:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.