我在 ASP.NET MVC 站点中启动并运行了 Elmah,我想将其界面与站点的管理页面集成。 默认情况下,您使用 url ~/elmah.axd 调用该接口,该接口在 MVC 系统外部运行。 安装要求您告诉 MVC 忽略路由,因此没有控制器或任何了解 elmah 的东西。 安装建议特定的忽略,即使默认情况下它已经被忽略:
public class MvcApplication : System.Web.HttpApplication {
public static void RegisterRoutes(RouteCollection routes) {
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.IgnoreRoute("elmah.axd");
...
}
我想尝试将 elmah.axd 集成为站点的组件。 我正在考虑有一个 Elmah 控制器,其视图使用 Futures 帮助器 Html.RenderRoute 但我不确定要传递什么参数:
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2>Elmah</h2>
<% Html.RenderRoute(???); %>
</asp:Content>
这有意义吗 - 有没有办法将 url 传递到 Html.RenderRoute? 有没有更好的方法不使用 Html.RenderRoute?
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?
发布评论
评论(2)
在你的视图中试试这个:
Try this in your View instead:
或者您可以在您的网站上使用此
Elmah 错误日志应用程序
or you can use this on your site
Elmah Error Log Application