I have a MVC project that uses a 3rd party upload .ashx page. I also have the following override for OnActionExecuting(ActionExecutingContext filterContext):
public override void OnActionExecuting(ActionExecutingContext filterContext) {
SessionContext context = (SessionContext)filterContext.HttpContext.Session[SessionConstants.SessionContext];
if (context == null || context.Ticket == null) {
filterContext.Result = new RedirectResult(TimeoutRedirectUrl);
return;
}
base.OnActionExecuting(filterContext);
}
This is here to make sure users are still logged in when they visit MVC pages. However, after a user uploads a file it looks like the "context" is null and then OnActionExecuting() redirects the user.
Why would there no longer be a context after a user uploads a file? I want them to still be logged in.
Have you tried using a controller action method to upload the file instead of the generic handler? Handlers are very low level and by default have no access to cookies, session, etc.