Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The error message "cs0120: An object reference is required for the non-static field, method, or property in ASP.Net Core MVC" means that a non-static field, method, or property is being accessed in a static context. This error occurs when an attempt is made to access an instance member of a class without first instantiating an object of that class. In ASP.Net Core MVC, this error can occur when a non-static method or property is accessed from a static method or property, or when a non-static field is used in a static context. To resolve this error, you should ensure that an object reference is created before accessing the non-static member.