0

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.

Lorenzo
  • 29,081
  • 49
  • 125
  • 222
Buchannon
  • 1,671
  • 16
  • 28

1 Answers1

0

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.

Dmitry S.
  • 8,373
  • 2
  • 39
  • 49
  • I guess that's the direction I should head in as I think it would solve a lot of problems. I'm only using a handler because the guy that worked on this project before me did. I wanted to try and make it work without a lot or rewriting but I don't think that's going to happen. – Buchannon Nov 29 '10 at 15:20