public ActionResult Index() { try { ViewBag.Error = false; var tempData = (MessageVM)TempData["UserMessage"]; TempData["UserMessage"] = tempData; ViewBag.DisplayName = Thread.CurrentPrincipal.Identity.Name; if (ViewBag.Path != null) { m_LdapService = new LdapService(ViewBag.Path); var usuario = m_LdapService.Search(); ViewBag.DisplayName = usuario.Nome; return(View(usuario)); } return(View()); } catch (Exception ex) { ViewBag.Error = true; TempData["UserMessage"] = new MessageVM() { CssClassName = "alert-error", Title = "Erro", Message = ex.Message }; Elmah.ErrorSignal.FromCurrentContext().Raise(ex); return(View()); } }