malaikuangren

What is the purpose or drive to build thing like (xxx),How can it achieve the original goal of design?
Session is null in ashx and in web api

Session is null in ashx

 
If the HttpContext.Current.Session is null in your .ashx handler, add System.Web.SessionState.IReadOnlySessionState to your class declaration, like this:
public class MyHandler : IHttpHandler, System.Web.SessionState.IReadOnlySessionState
Also, if you need to write to Session[], you can use IRequresSessionState instead of IReadOnlySessionState.
see also:
http://forums.asp.net/t/1773026.aspx/1
http://stackoverflow.com/questions/7705802/httpcontext-current-session-is-null-in-mvc-3-appplication

posted on 2012-08-26 17:01  malaikuangren  阅读(513)  评论(0编辑  收藏  举报