如何AXD(ELMAH)集成在ASP.NET MVC站点组件
-
23-08-2019 - |
题
我ELMAH启动和运行在我的ASP.NET MVC网站,我想它的界面与网站的管理页面进行整合。默认情况下,调用与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控制器与使用期货助手Html.RenderRoute的视图,但我不知道通过什么样的参数:
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2>Elmah</h2>
<% Html.RenderRoute(???); %>
</asp:Content>
这是否有道理 - 是有没有办法通过URL中Html.RenderRoute?有没有不使用Html.RenderRoute更好的办法?
解决方案
在您查看
试试这个:
<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>
其他提示
或者你可以在网站上使用这个
不隶属于 StackOverflow