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

Calendar in Asp.net

CheckBox in Asp.Net MVC (Insert Data of CheckBox in Database and GetData Of checkBox From DataBase)