//[CaptchaMvc.Attributes.CaptchaVerify("Captcha Inválido")] public ActionResult Logar(Login login) { try { if (ModelState.IsValid) { var loginBO = new LoginBO(); if (loginBO.Autenticar(login.cpf, login.senha)) { if (string.IsNullOrEmpty(_ip)) { _ip = Request?.ServerVariables["HTTP_X_FORWARDED_FOR"] ?? Request?.ServerVariables["REMOTE_ADDR"] ?? Request?.UserHostAddress; } //_ip = FormatIP(_ip); necessário implementar o método formatar o ip retirando as vígulas. var usuario = new UsuarioLogado { Nome = "Usuario", Cpf = login.cpf }; new Session(usuario); return(RedirectToAction("Index", "Home")); } else { ViewData["Messagem"] = "Dados do candidato não conferem!"; } } } catch (Exception ex) { throw ex; } return(View("Index", "Login")); }