C
C#6mo ago
IamMax420

object ref not set blah blah blah

atp i have no Idea what I did wrong. In the following function: public async Task<IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return Page(); } var result = await _signInManager.PasswordSignInAsync(Input1.Username, Input1.Password, false, false); if (result.Succeeded) { return RedirectToPage("/Index"); } else { ModelState.AddModelError(string.Empty, "Invalid login attempt."); return Page(); } } the PasswordManagerAsync() method is throwing the aforementioned exception
1 Reply
IamMax420
IamMax420OP6mo ago
here's the cshtml file btw @page @model AplikacjaWeb.Pages.Logowanie.LogowanieModel @{ } <h1 class="Logowanie">Logowanie</h1> <div class="container border" style="padding:20px;"> <form method="post" style="margin-left:400px;"> <div class="text-danger" asp-validation-summary="ModelOnly"></div> <div class="form-group row div1"> <div class="col-3 column1"> <label asp-for="Input1.Username">Username:</label> </div> <div class="col-2"> <input type="text" asp-for="Input1.Username" class="form-control" style="margin-left:-110px; margin-top:-10px; width:250px;" /> </div> <span class="text-danger" asp-validation-for="Input1.Username"></span> @*ten span sprawia że gdy user nie wprowadzi danych do pola to zostanie wyswietlona wiadomosc z atrybutu required*@ </div> <div class="form-group row div2"> <div class="col-3 column2"> <label asp-for="Input1.Password">Password:</label> </div> <div class="col-2"> <input type="password" asp-for="Input1.Password" class="form-control" style="margin-left:-110px; margin-top:-10px; width:250px;" /> </div> <span class="text-danger" asp-validation-for="Input1.Password"></span> </div> <div> <button type="submit" class="przycisk1">Zaloguj</button> </div> </form> </div> nvm forgot to add the [BindProperty] attribute 💀
Want results from more Discord servers?
Add your server