この記事では、セッション状態へのアクセスを可能にする別のイベントハンドラでELMAHのエラーハンドラをラップする方法について説明します:Global.asaxの中
http://groups.google.com/group/elmah/msg/a0aa776d348ba97e
、あなたが何かを持っている可能性がありなどは、以下:
protected void Application_PreRequestHandlerExecute(Object sender, EventArgs e)
{
// Get the filename being requested
string filename = Path.GetFileName(Request.Path).ToLower();
// Verify that a user is logged in by checking the session
bool isValid = (HttpContext.Current.Session["User"] != null);
// Throw error if invalid
if (filename == "elmah.axd" && !isValid)
throw new SecurityException("Access to elmah.axd is denied");
}
標準ELMAHハンドラがIRequiresSessionStateまたはIReadOnlySessionStateを実装していないので、あなたは別のものを作成する必要があります上記のリンクで説明されているように、これをラップするイベントハンドラです。そうしないと、Application_PreRequestHandlerExecuteイベントでセッションにアクセスできなくなります。
出典
2010-03-19 18:23:47
Mun