Redirect to current view on error in asp.net mvc?
        Posted  
        
            by Pandiya Chendur
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Pandiya Chendur
        
        
        
        Published on 2010-05-17T10:10:00Z
        Indexed on 
            2010/05/17
            10:21 UTC
        
        
        Read the original article
        Hit count: 238
        
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");
     }
© Stack Overflow or respective owner