Essentially, I'm trying to authenticate a user by providing their account and their social security number. If they enter the wrong combination, I do the following in the post Authenticate post:
ModelState.AddModelError("Authenticated", authenticationError); return View();
An error is displayed here, but then I lose what was in my query string. An alternative to storing a query string is:
ModelState.AddModelError("Authenticated", authenticationError); return Redirect(Request.Url + "?returnUrl=" + returnUrl);
This will contain a query string, but the error will not be displayed. I assume this happened because ModelState has changed.
I need returnUrl because the user is forced to the Authenticate page whenever he clicks a button to view a specific event. I want to configure it so that they still go to this event as soon as they authenticate.
Is there a way I can achieve both saving the query string and displaying a model error?
source share