Sever.Transfer from ASHX handler, HttpContext.Current.Session is null
asp.net
Solution
You got to mark handler with IRequiresSessionState marker interface in order to have Session initialized. If you only need to read from session use IReadOnlySessionState marker interface, so Session State Provider can skip saving session at the end of request. In case of out of proc Session State Provider that can give some gains in performance.
Here is the example :
using System.Web.SessionState;
namespace BlahBlah
{
public class CustomHandler : IHttpHandler, IRequiresSessionState
...
}
Problem
So I'm trying to do a `Server.Transfer` from a generic handler to an regular ASPX page. It transfers okay, but it's finding the `HttpContext.Current.Session` is null. Anyone know why? Thanks for the help! -Ev