I work on a ASP.NET MVC project, I create a Controller
named AuthenticationController
, this controller contains a static method
called User_Access_Validation
.
This method check some cookies values.
So that is method code :
public void User_Access_Validation()
{
if (Request.Cookies["X_8"] == null || Request.Cookies["X_5"] == null || Request.Cookies["X_T"] == null)
{
Response.Redirect("/Login");
}
}
Everythings works good at now, but when I change this method to a static
method I got these four errors in ErrorList in Visual Studio
Error CS0120 An object reference is required for the non-static field, method, or property
Error CS0120 An object reference is required for the non-static field, method, or property
Error CS0120 An object reference is required for the non-static field, method, or property
Error CS0120 An object reference is required for the non-static field, method, or property
So please I need this method to be a static
method, and fix this error