Can not sign in using ASP.NET Identity, Value cannot be null.Parameter name: manager
<p>I've this login method when I reach at this point it gives me an error </p>

<pre><code>var result = SignInManager.PasswordSignIn(userName, password, false, false);
</code></pre>

<p>The exception it shows is this </p>

<blockquote>
  <p>An exception of type 'System.ArgumentNullException' occurred in
  Microsoft.AspNet.Identity.Owin.dll but was not handled in user code</p>
  
  <p>Additional information: Value cannot be null.</p>
</blockquote>

<p>But here is the main error that it shows </p>

<blockquote>
  <p>{"Value cannot be null.\r\nParameter name: manager"}</p>
</blockquote>

<p>here is the stack trace </p>

<pre><code>   at Microsoft.AspNet.Identity.Owin.SignInManagerExtensions.PasswordSignIn[TUser,TKey](SignInManager`2 manager, String userName, String password, Boolean isPersistent, Boolean shouldLockout)
   at MIS.Web.Controllers.PublicController.ValidateUser(String userName, String password) in C:\Users\Jack\Dropbox\Angular 2 Test Environment\MIS BackUp\MIS.Web\MIS.Web\Controllers\PublicController.cs:line 138
   at lambda_method(Closure , ControllerBase , Object[] )
   at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)
   at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.&lt;BeginInvokeSynchronousActionMethod&gt;b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.&lt;InvokeActionMethodFilterAsynchronouslyRecursive&gt;b__3d()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.&lt;&gt;c__DisplayClass46.&lt;InvokeActionMethodFilterAsynchronouslyRecursive&gt;b__3f()
</code></pre>

<p>This here is my complete login method </p>

<pre><code> public string ValidateUser(string userName, string password)
        {
            var userStore = new UserStore&lt;IdentityUser&gt;();
            userStore.Context.Database.Connection.ConnectionString =
                System.Configuration.ConfigurationManager
                .ConnectionStrings["Test"].ConnectionString;
            var manager = new UserManager&lt;IdentityUser&gt;(userStore);


            var user = manager.Find(userName, password);
            manager.UpdateSecurityStampAsync(user.Id);



            var result = SignInManager.PasswordSignIn(userName, password, false, false);
            if (result == SignInStatus.Success)
                return userName;

            ModelState.AddModelError("", "Invalid login attempt.");
            return null;
        }
</code></pre>