How to Log out of session in MVC

Logging out is an important step when it comes to security. Simply closing the browser may not clear the data you were accessing. Below is a function that you use from inside a controller to log out the right way.

Log out action in MVC

public ActionResult LogOut()
    return RedirectToAction("index", "home");

Happy Coding!!!

Related Articles

Create a newline in rich text box in C#

Bind Countries to a DropDownList in ASP.NET using C#

Check for Even or Odd Number Using C#


Tutorials Panel

About Tutorials Panel

programming tutorial and source code for Software Engineers and developers.

View all posts by Tutorials Panel →

Leave a Reply