/// <summary> /// Logs the user of from the current request context. /// </summary> /// <param name="context">The <see cref="IMansionContext"/>.</param> /// <param name="authenicationProvider">The authentication provider which to use.</param> protected override void DoLogoff(IMansionContext context, AuthenticationProvider authenicationProvider) { // authenticate authenicationProvider.Logoff(context); // get the web request context var webContext = context.Cast<IMansionWebContext>(); // check session if (!webContext.Session.IsWritable) throw new InvalidOperationException("Could not log off user because the session is not writeable"); // clear the user from the session webContext.Session.Remove(GetRevivalCookieName(context)); // delete any revival cookies context.DeleteCookie(GetRevivalCookieName(context)); }