Logout In MVC

Code

[Route("out")]
        public ActionResult logout()
        {

            Session["username"] = null;
            Session["password"] = null;
            return View("Login");

        }


csHtml


  @if (Session["username"] == null && Session["password"] == null)
                    {
                        <li><a href="~/Account/Login">Login</a></li>
                    }
                    else 
                    {
                        <li><a href="~/Account/out">Logout</a></li>
                    }

Comments

Popular posts from this blog

Search Record From Table Using jQuery in Asp.net core MVC

How To insert Radio Button Data in DataBase -- MVC

Toolbox Webparts Controls