Customize elmah.axd output fields

后端 未结 2 1389
遥遥无期
遥遥无期 2021-01-04 23:49

ELMAH shows host, code, type, error, user, date and time by default on its error log web page. Is there any way to configure it and show other fields like IP or REFERER?

2条回答
  •  伪装坚强ぢ
    2021-01-05 00:14

    You could write your own error page. Bind a datagrid to ErrorLog.GetErrors() and use whatever columns you want:

    List entries = new List();
    ErrorLog.GetDefault(HttpContext.Current).GetErrors(0, 50, entries);
    string ip = entries[0].Error.ServerVariables["REMOTE_ADDR"];
    string referrer = entries[0].Error.ServerVariables["HTTP_REFERER"];
    

提交回复
热议问题