Custom Login Using Entity Framework in asp.net MVC using Razor | Angular | ASP.NET Tutorials

For Consultation : +91 9887575540

Stay Connected :

Step 1: First Create new Project in Visual studio.

MVC New Project

Step 2: create new asp.net web application

CreateNewASP.NET MVC Project

Step 3: Create new MVC Empty Project

New MVC Empty Project


Step 4: First We will write connection string into web.config. In this example I have created a database named MVCEx and a table Login into it.

Database Table

Step 5: Install Entity Framework into project using package manager console.


Step 5: Write shell command to install Entity Framework

install-package entityframework

Entity Framework Installation Command

Step 6 : Now create two classes into Models folder , In this example I created two classes named DataContext.cs and Login.cs and write code.



Step 7: Create new Controller Home write code like below.

Step 8 : Create Index.cshtml in View Folder


@using (Html.BeginForm()) {

@if (msg != null) { @Html.Label(msg); }

User Name@Html.TextBoxFor(m => m.UserName)
Password@Html.PasswordFor(m => m.Password)


Step 9: Now run and see results



Download Complete Source Code

Select your currency
Open chat
Powered by