I'm trying to implement custom authorization in a MVC 4 application for ImageResizer (3.3.2) and everything works fine until I try to access session variables.
In global.asax I've added the following event listener to the pipeline:
ImageResizer.Configuration.Config.Current.Pipeline.AuthorizeImage += (m, c, args) =>
{
// check authorization only for asset path
if (args.VirtualPath.IndexOf("/Assets/", StringComparison.OrdinalIgnoreCase) > -1)
{
// HttpContext from parameter
// c.Session is always null
// Static access
// HttpContext.Current.Session is also null
}
};
As noted in the code, Session is always null. Is there a way to configure the module to be session enabled or any other way to access session variables?
This question is essentially the same.