views:

113

answers:

1

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?

+1  A: 

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.

ebrown
Aha, this is right what i figured out. AJAX is the only option to create portal like sites in MS MVC without trying to simulate something like viewstate in webforms.
Arnis L.