using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.Cookies; namespace RR3CommunityServer.Pages; public class LogoutModel : PageModel { private readonly ILogger _logger; public LogoutModel(ILogger logger) { _logger = logger; } public async Task OnGetAsync() { var username = User.Identity?.Name ?? "Unknown"; await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme); _logger.LogInformation("User logged out: {Username}", username); return RedirectToPage("/Login"); } }