当前位置: 代码迷 >> ASP.NET >> HttpModule中没后缀就不能获得Session
  详细解决方案

HttpModule中没后缀就不能获得Session

热度:2564   发布时间:2013-02-25 00:00:00.0
HttpModule中没有后缀就不能获得Session?
那微软的mvc3框架是怎么获得Session的,有源码,但看不懂···

------解决方案--------------------------------------------------------
人家的源码不是用来给陌生人看的,这么多代码,你看到什么时候才能写程序啊。

 private void BeginRequest(object o, EventArgs e)
{
HttpApplication app = o as HttpApplication;
HttpContext content = app.Context;

content.Session["test"];

//我试验了一下可以获取Session
}
------解决方案--------------------------------------------------------
肯定确定。

我的程序的权限控制就是通过 HttpModule 控制了,用了很多年了。

HttpHandlers获取不到还说得过去。继承上 IRequiresSessionState 接口就可以用session 了。

C# code
public class UrlRewriter : IHttpHandler, IRequiresSessionState
  相关解决方案