IMG-LOGO

How to sign out in ASP.Net Core page?

andy - 05 Apr, 2021 3779 Views 0 Comment

If you need to apply a sign out link in ASP.Net Core page. You can utilizie the built-in method under HttpContext.

This class is inherited from Microsoft.AspNetCore.Http namespace.

In your ASP.Net Core page controller. You can create a method named Logout. See below example.

public async Task<IActionResult> Logout()
{
	await HttpContext.SignOutAsync();
	return RedirectToAction("Index", "Home");
}

After you call the SignOutAsync method. You can perform a redirection action. Above example will redirect to Home Controller page.

Comments

There are no comments available.

Write Comment
0 characters entered. Maximum characters allowed are 1000 characters.

Related Articles

ASP.Net Core 2.0 - HTTP Error 502.5

When you deploy your asp net Core 2 0 application you may receive the following error message which is about processing failure or HTTP error 502 5 This particular error is maybe caused by the program can t start because ...