samedi 18 avril 2015

Persisting sensitive data over a multi-action signup process in MVC

I have a registration form that is split across two distinct controller actions:



register/form1
register/form2


register/form1 requests an email and password (amongst other things), register/form2 requests some business details (name, address etc). form2 then finally posts to the server to create the account.


In form1 I have a view model that stores the given email and password, from the actual view. I then post it back to register/form1 so that I can validate the email availability server side.


If the email is available I then RedirectToAction form2 passing the view model over.



RedirectToAction("form2", myviewmodel)


Now when reading the view model in form 2 it's pulling the information out of the querystring. As part of the form1 view model I have password, I don't want this appearing plain text in the querystring. I could encrypt it before sending to form2 but is there a better way to persist such data?


I also realise that I could just post from form1 view directly to form2, but then if the email check fails I need to get back onto form1 with the data persisted, which I'm guess would again involve a get request to form1 with all the original values in the querystring.


If possible I also want to avoid using TempData (or anything session based) to make the application as stateless as possible, it will eventually end up on a load balancer.


Thank you for your patience, I am coming from WebForms so I'm still trying to get my head around some MVC concepts.


Aucun commentaire:

Enregistrer un commentaire