Dawid Ruchniewicz

Dawid Ruchniewicz

  • NA
  • 28
  • 3.1k

Identity - Binding Register/Login methods with my old forms

Nov 23 2018 6:49 PM
Hey everyone
 
I have a problem
 
I have a web application in AspNetCore 2.1. Two months ago on start page, i made two forms - for register user and login user and I used Post method to register and login. Lately, I configured my user management to use with Identity framework, and I can't use embedded default Identity Register/Login views but I can use Register.cshtml.cs and Login.cshtml.cs to my forms (which I made).
 
I bind my login and passwords inputs with RegisterModel and ModelLogin Input fields and that is ok, but problem is how can I bind my form with Register.cshtml.cs ? I'll try
(<-- this is default form in register identity, in @Model I have a field that reference to RegisterModel from Identity so that is ok too) but I get error NullReferenceExcetpion :
 
Object reference not set to an instance of object. If I change to application is started without errors, but if I can register user nothing happens and return to start page. So probably is something wrong with this returnUrl, which is set in register function to null, but in default Identity cases it works good. I'll attach a most important files. Summary, my question is how can I bind my Register and Login forms with Register/Login functions form Identity framework.

Attachment: IdentityForms.zip

Answers (6)