1

In my AccountController under beta4 of ASP.NET vNext, we were logging out by using:

Context.Response.SignOut(OpenIdConnectAuthenticationDefaults.AuthenticationScheme);
Context.Response.SignOut(CookieAuthenticationDefaults.AuthenticationType);

This worked great and the user ended up on the login page of Office 365 as we expected.

After updating to beta6, the SignOut method was shown as an error. We replaced it with the below, but the logout never seems to correctly happen. The user is immediately thrown back to the Home Page logged in. I have tried SignOutAsync and ForbidAsync and even both of them together, but still can't log user out since update.

var properties = new AuthenticationProperties
    {
        AllowRefresh = false,
        ExpiresUtc = DateTime.UtcNow.AddDays(-1),
        IsPersistent = true,
        RedirectUri = "/",
        IssuedUtc = DateTime.UtcNow
    };
await     Context.Authentication.SignOutAsync(OpenIdConnectAuthenticationDefaults.AuthenticationScheme, properties);
await Context.Authentication.SignOutAsync(CookieAuthenticationDefaults.AuthenticationType, properties);

What is the recommended (or any) way to correctly log out a user in beta6 and have them re-directed to the Office 365 login screen?

2
  • Please use the { } button (or four spaces) to format a code block. Only use ` for inline code.
    – Jamie Rees
    Jul 28, 2015 at 15:13
  • how did you make login work? Aug 31, 2015 at 14:11

1 Answer 1

1

What's in the rest of your controller action? The behavior has changed recently where redirects are applied immediately when sign out is called rather than delayed, see: Similar issue

1
  • The link you provided answered the question. Once I removed the Redirect and just had a void return on my LogOut, it worked as expected. Thanks for your help!
    – r2musings
    Jul 29, 2015 at 1:45

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.