FormsAuthentication
FormsAuthentication class from System.Web.Security is used to authenticate a user whether login or not. FormsAuthentication class has many functions to check the user login and it's very easy to implement. Follow the code given below
Views
<h2>Login</h2>
<form method="post">
<input type="text" name="UserName" placeholder="User Name" required /><br /><br />
<input type="password" name="Password" placeholder="Password" required /><br /><br />
<input type="submit" value="Login" />
@if
(Request.QueryString["msg"] != null)
{
<br /><br />
<span style="color:red">@Request.QueryString["msg"]</span>
}
</form>