Redirect to current view on error in asp.net mvc?
- by Pandiya Chendur
I use TempData["message"] which internally uses session.... It works for me but when i do a
return RedirectToAction("Create"); my other values are not restored because i am redirecting to Create view... Any suggestion how to retain the values of textboxes in the view.....
if (!regrep.registerUser(reg))
{
TempData["message"] = string.Format("{0} already exists", reg.EmailId);
return RedirectToAction("Create");
}
else
{
return RedirectToAction("Index");
}