Tutorial :MS MVC login widget



Question:

Context
In LAYOUT, i got 2 input fields and submit button.
If user authentication is successfully, i want to redirect him somewhere, if not - i want page to be updated with some validation text.

Problems Cause widget is supposed to be located in layout, i dont know which is current page, therefore - cant get back on failed authentication (even worse - i know nothing about page state (changed fields, selected items in checkboxes, etc.)).

I could save state doing partial request on login form submit, but then - how could i redirect user on successfully authentication without javascript hacks?


Solution:1

I think you would want to submit the login asynchronously with ajax. Since it won't do a full postback on submit, the page state should stay the same if the login fails. If the authentication is successful you could just redirect to wherever you want to send them.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »