怎样在HttpModule捕获到session?
HttpModule如下:
public void Init(HttpApplication context)
{
context.AcquireRequestState += new EventHandler(context_AcquireRequestState);
}
void context_AcquireRequestState(object sender, EventArgs e)
{
HttpApplication application = (HttpApplication)sender;
string url = application.Request.Url.ToString();
string userName = Convert.ToString(application.Session["UserName"]);
......
application.Session["UserName"]出错:会话状态在此上下文中不可用
请问怎样在HttpModule中获得Session? 请帮忙,多谢了。。