title: Need help on Services definition
body: <p><strong>These are my codes in Controller:</strong></p>
  <pre><code> public class IdentityUserController : Controller
  {
      private readonly UserManager&lt;DatabaseContext&gt; _um;
      private readonly SignInManager&lt;DatabaseContext&gt; _sm;
      
      [HttpGet]
      public IActionResult Login()
      {       
          return View();
      }
  
      [HttpPost]
      public async Task&lt;IActionResult&gt; Login( Models.Person  lc)
      {
  
          if (ModelState.IsValid)
          {
               var result = await _sm.PasswordSignInAsync(lc.NationalCode, lc.Password, false, true);
              if (result.Succeeded)
              {
                  TempData[&quot;LoggedUserCode&quot;] = lc.NationalCode;
                  ViewBag.LoggeduserDetails = lc.Name + &quot; &quot; + lc.Family;
                  return RedirectToAction(&quot;Index&quot;,&quot;Home&quot;);
              }
              ModelState.AddModelError(&quot;&quot;, &quot;User or Password not valid&quot;);
          }
          return View(lc);
      }
  </code></pre>
  <p>}</p>
  <p><strong>and these are codes in startup Configuration:</strong></p>
  <pre><code>  public void ConfigureServices(IServiceCollection services)
      {
          services.AddControllersWithViews();
          services.AddDbContext&lt;DatabaseContext&gt;(option =&gt; option.UseSqlServer(@&quot;Data Source =. ; Initial Catalog = LeaveSheet; Integrated Security=True;MultipleActiveResultSets=true &quot;));
          services.ConfigureApplicationCookie(option =&gt; option.LoginPath = &quot;/IdentityUser/Login&quot;);
      }
  </code></pre>
  <h2><strong>when I run it I get below error in login view after submit:</strong></h2>
  <p><em><strong>NullReferenceException: Object reference not set to an instance of an object.</strong></em></p>
  <ul>
  <li><p>LeaveSheet.Controllers.IdentityUserController.Login(Person lc) in IdentityUserController.cs</p>
  <pre><code>            var result = await _sm.PasswordSignInAsync(lc.NationalCode, lc.Password, false, true);
  </code></pre>
  </li>
  </ul>
  <p>Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor+TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, object controller, object[] arguments)
  System.Threading.Tasks.ValueTask.get_Result()
  System.Runtime.CompilerServices.ValueTaskAwaiter.GetResult()
  Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask actionResultValueTask)
  Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted)
  *</p>
  <p>**would you please helping me **</p>