问题描述:
在filter 中对session 进行赋值时报的错误“”未对对象引用到实例“”
解决方案:
在Global.asax 中加入以下代码即可
public override void Init()
{
PostAuthenticateRequest += MvcApplication_PostAuthenticateRequest;
base.Init();
}
void MvcApplication_PostAuthenticateRequest(object sender, EventArgs e)
{
HttpContext.Current.SetSessionStateBehavior(SessionStateBehavior.Required);
}