Published on: 05 Apr, 2021

How to sign out in ASP.Net Core page?

Tumblr Digg Google Plus

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.


There are no comments available.

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