Difference between revisions of "Create logout for ASP.Net Web App"
(Created page with "Create a new Razor Page called `logout`. Go to the logoutModel code section (right click it in solution explorer and select goto PageModel). Now change the `OnGet` method to...") |
|||
Line 12: | Line 12: | ||
return LocalRedirect("/Index"); | return LocalRedirect("/Index"); | ||
} | } | ||
− | <syntaxhighlight> | + | </syntaxhighlight> |
Revision as of 13:55, 16 October 2024
Create a new Razor Page called `logout`.
Go to the logoutModel code section (right click it in solution explorer and select goto PageModel).
Now change the `OnGet` method to this:
public IActionResult OnGet()
{
HttpContext.Session.Clear();
return LocalRedirect("/Index");
}