Display Property Name Gives the resource cannot be found error

344 Views Asked by At

I'm a newbie in MVC web application development in c#. Here I'm building a c# MVC Web application. I have a login form. I created the web application MVC project with .net framework 4.5. I'm using visual studio 2017.

The work I did with my application works fine until I do this modification in my model. The modification what I did was adding a display name property like this.

public partial class User
    {
        public int UserID { get; set; }
        [DisplayName("User Name")] //This is the line I added. 
        public string UserName { get; set; }

        public string UserPWD { get; set; }
    }

After I do this modification, when I rebuild and run the application it gives me following error.

Server Error in '/' Application. The resource cannot be found. Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.

Requested URL: /

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.3282.0

What have I missed in this?

1

There are 1 best solutions below

2
On

set Name="" to Anoutation

 [Display(Name="User Name")]