title: system.reflection.targetException c# error
body: <p>I have an MVC app that I am getting a system.reflection.targetexception non-static method requires a target this happens on my base controller when I am re-directing them to the right spot of my app I am just basically trying to updatelastlogindate.</p>
  
  <pre><code> case "employeecenter":
                                  Common.AppName = "Employee Center";
                                  if (Session["LLD_EmpCenter"] == null)
                                  {
                                      Session["LLD_EmpCenter"] = true;
                                      System.Threading.Tasks.Task.Factory.StartNew(() =&gt;
                                      {
                                          try
                                          {
                                              Common.Instance.UpdateLastLoginDate(User.Identity.Name);
                                          }
                                          catch (ArgumentException e)
                                          {
  
                                          }
                                      });
                                  }
  </code></pre>
  
  <p>the error happens on common.instance.updateLastloginDatewith the user.identity.name which does have a value it is not null so I am not sure why the error is happening. even having a try catch around this still throws this exception and causes my debugger to stop. </p>
  
  <pre><code> namespace KMSSecurity
      {
          public class Common : IDisposable
          {
              public Common();
  
              public static string AppName { get; set; }
              public static string ConnectionString { get; set; }
              public static Common Instance { get; }
              public KMSSecurityContext Context { get; protected set; }
  
              public bool ChangeAppPermissionForUser(Guid appId, string userName, bool grant);
              public bool ChangeCategoryPermissionForUser(int categoryId, string userName, bool grant);
              public bool ChangePassword(string userName, string oldPassword, string newPassword);
              public void ChangePasswordQuestionAndAnswer(string username, string password, string passwordquestion, string passwordanswer);
              public bool ChangePermissionForUser(Guid roleId, int categoryid, string permissionName, string userName, bool grant);
              public bool ChangePermissionForUser(Guid roleId, string permissionName, string userName, bool grant);
              public bool ChangeRolePermissionForUser(Guid roleId, string userName, bool grant);
              public void CopyUserPermissions(string userNameFrom, string userNameTo, Guid appId);
              public void CopyUserPermissions(string userNameFrom, string userNameTo, string applicationName);
              public Guid CreateApplication(string appName);
              public int CreateCategory(string appName, string roleName, string categoryName, string categoryDesc, int displayOrder);
              public bool CreatePermission(string permissionName, string permissionDesc, string permissionHelpText, int displayOrder, int categoryId);
              public Guid? CreateRole(string appName, string roleName, string roleDescription);
              public MembershipUser CreateUser(string userName, string email, string passwordQuestion, string passwordAnswer);
              public MembershipUser CreateUser(string userName, string passWord, string email, string passwordQuestion, string passwordAnswer);
              public UserPermissions CreateUserPermissions();
              public UserPermissions CreateUserPermissions(string userName);
              public UserPermissions CreateUserPermissions(string userName, List&lt;Role&gt; initialPerms);
              public UserPermissions CreateUserPermissions(string appName, string userName);
              public bool DeleteApplication(Guid applicationId);
              public bool DeleteCategory(int categoryId, bool deleteOnlyIfIsEmpty);
              public bool DeleteCategory(string appName, string roleName, string categoryName, bool deleteOnlyIfIsEmpty);
              public bool DeletePermission(Guid appId, Guid roleId, int categoryId, string permissionName, bool deleteOnlyIfRoleIsEmpty);
              public bool DeleteRole(string appName, string roleName, bool deleteOnlyIfRoleIsEmpty);
              public bool DeleteRole(Guid roleId, bool deleteOnlyIfRoleIsEmpty);
              public bool DeleteUser(string userName);
              public void DisableLogin(string userName);
              public bool EditCategory(int id, string name, string desc, int displayOrder);
              public bool EditPermission(int categoryId, string permissionName, string permissionDesc, string permissionHelpText, int displayOrder, int newCategoryId);
              public bool EditRole(Guid id, string desc);
              public void EnableLogin(string userName);
              public List&lt;Security_User&gt; GetAdministrators();
              public List&lt;Security_User&gt; GetAllUsers();
              public Application GetApplication(Guid applicationId);
              public List&lt;Application&gt; GetApplications();
              public List&lt;Security_User&gt; GetApplicationUsers(Guid applicationId);
              public int GetAvailableDisplayOrder(int categoryId);
              public int GetAvailableDisplayOrder(Guid roleId);
              public List&lt;Role&gt; GetAvailablePermissions(string appName);
              public List&lt;string&gt; GetCategoriesNames(string appName, string roleName);
              public Security_Category GetCategory(int id);
              public Security_Category GetCategory(string appName, string roleName, string categoryName);
              public List&lt;string&gt; GetCategoryPermissionNames(int categoryId);
              public List&lt;string&gt; GetCategoryPermissionNames(string appName, string roleName, string categoryName);
              public User GetCombinedUser(string userName);
              public string GetPasswordQuestion(string userName);
              public Security_Permissions GetPermission(int categoryId, string permissionName);
              public List&lt;Security_Permissions&gt; GetPermissionsForRole(string roleName, string appName);
              public List&lt;Security_Permissions&gt; GetPermissionsForRole(string appName, string roleName, string categoryName);
              public Role GetRole(Guid roleId);
              public Role GetRole(string roleName, string appName);
              public List&lt;Security_Category&gt; GetRoleCategories(string roleName, string appName);
              public List&lt;string&gt; GetRoleNames(string appName);
              public List&lt;string&gt; GetRolePermissionNames(string roleName, string appName);
              public ICollection&lt;Role&gt; GetRoles(Guid applicationId);
              public List&lt;Role&gt; GetRolesForUser(string appName, string userName);
              public List&lt;Security_User&gt; GetUserForAllApps(string userName);
              public Security_User GetUserForApp(string userName, string appName);
              public List&lt;Security_User&gt; GetUserForPermission(int categoryId, string permissionName);
              public MembershipUser MembershipUser(string userName);
              public string ResetPassword(string userName, string passwordAnswer);
              public bool ResetPassword(string userName, string defaultPassword = "", string passWordSalt = "", int passwordFormat = 1);
              public bool RoleExists(string roleName, string appName);
              public bool UnlockUser(string userName);
              public void UpdateEmail(string userName, string email);
              public void UpdateLastLoginDate(string username);
          }
      }
  </code></pre>
  
  <p>This is my common class and it is expecting a username which is getting passed to the updateLastLoginDate any help would be greatly appreciated.</p>