一个主题页面错误内ELMAH
-
20-09-2019 - |
题
我由此选择了一个HTTP模块内的主题的主题的页面。
public void context_PreRequestHandlerExecute(object sender, EventArgs e)
{
Page p = HttpContext.Current.Handler as Page;
if (p != null)
{
//get theme
string theme = GetTheme(HttpContext.Current.Request.Url.Host);
Debug.WriteLine(String.Format("Loading theme {0}", theme));
//set theme of page
p.Theme = theme;
}
}
现在,当我请求如下的抛出异常的elmah.axd:
使用主题的CSS文件需要页面上的报头控制。 (例如)。
当我禁用HTTP主题模块一切正常并且elmah.axd显示的网页。我认为这是ErrorLogPage里面的小错误。该ErrorLogPage要应付的事实,一个主题可以给页面或应不惜一切忽略特定主题。
有关现在我使用变通方法:
private const string ELMAH_ERROR_PAGE = "Elmah.ErrorLogPage";
if (p.GetType().FullName != ELMAH_ERROR_PAGE)
{
p.Theme = theme;
}
你有什么更好的意见或想法?
的Gr
马亭
荷兰
解决方案
结果:
你的问题的解决方案已经回答过了 排除使用特定页面的HTTP模块。
您可以使用一个HttpHandler代替 的HTTP模块。处理程序让你 当你宣布他们指定的路径 在Web.Config中。
<add verb="*" path="/validate/*.aspx" type="Handler,Assembly"/>
如果你必须使用一个HttpModule,你 可能只是检查的路径 请求,如果它是一个要 排除在外,绕过验证。
不隶属于 StackOverflow