Question: Please help to make changes for my login webpage using ASP.NET with validations involved. When the user enters an invalid name or/and password, it will
Please help to make changes for my login webpage using ASP.NET with validations involved. When the user enters an invalid name or/and password, it will display the error message "invalid username or/and password".
The username and password must be exactly the same stored in the database as shown below. Once successful, user will be brought to a new page "home.cshtml" when clicking on the login button.
The home webpage will display the message 'Welcome admin" at the top right hand corner of the page.
Database called "logindetails" with the following info in the table:

-------------------------------------------------------------------------------------------------------
Below are my Razor C# codes:
loginpage.cshtml
@{ Validation.RequireField("username", "Name is required."); Validation.RequireField("password", "Password is required.");
var db = Database.Open("logindetails"); var username = Request.Form["username"]; var password = Request.Form["password"];
if (IsPost && Validation.IsValid()) { if (ModelState.IsValid) {
Response.Redirect("~/home"); } }
}
Please Login
@Html.ValidationSummary("Errors with your submission:")
-----------------------------------------------------------------------------------------------
Id username password mypass123 1 1 admin Id username password mypass123 1 1 admin
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
