views:

41

answers:

1

In a master / detail scenario, I use an Edit ActionLink that fetches the partial details view via a jQuery Ajax call; pretty typical, right?

The problem I've come across is when a user's auth token expires and he clicks on the Edit ActionLink. The returnUrl parameter of the LogOn action is being set by the ActionLink that returns the partial view, and upon successful authentication, a big white screen with only the partial view is shown.

This actually applies to any of the many Ajax action links that return partial views--anytime one of them triggers a redirect to the LogOn action due to an expired authentication ticket.

        [HttpPost]
        public ActionResult LogOn(LogOnModel model, string returnUrl)
        {
            if (ModelState.IsValid)
            {
                if (MembershipService.ValidateUser(model.UserName, model.Password))
                {
                    FormsService.SignIn(model.UserName, model.RememberMe);
                    if (!String.IsNullOrEmpty(returnUrl))
                    {
                        return Redirect(returnUrl);
                    }
                     .....

Of course the return Redirect(returnUrl); is the problem here.

I'm wondering how other people deal with this scenario.

Thanks.

A: 

I use the jQuery Idle Timout for this scenario. I just return a login screen, inside a partial view, when the user get's logged out. Just set the timeout value to the same value as your session logout time.

Victor
Oooo sounds promising. I'll take a look right away.
PolishedTurd
Do you happen to know if those issues brought up in the comments were resolved? Have you needed to modify the plugin at all?
PolishedTurd
I haven't read through the comments to see exactly what the issues were. I'm not really using all of the features, like polling to see if the session is active. In a basic scenario it seems to work great for I need it for.
Victor