public ActionResult Index(LoginViewModel loginVM) { if (ModelState.IsValid) { try { Seguranca.ValidaLogin(loginVM); FormsAuthentication.SetAuthCookie(loginVM.Usuario, false); string returnUrl = Request.Form["returnUrl"]; if (this.Url.IsLocalUrl(returnUrl)) { return(Redirect(returnUrl)); } else { return(RedirectToAction("Index", "Home")); } } catch (Exception e) { ModelState.AddModelError("", e.Message); } } return(View(loginVM)); }