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:

Please help to make changes for my login webpage using ASP.NET with

-------------------------------------------------------------------------------------------------------

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"); } }

}

Login Page

Please Login

@Html.ValidationSummary("Errors with your submission:")

Login Details

-----------------------------------------------------------------------------------------------

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!