Problem with page return according to profile C #

1

I'm trying to return a page according to the user profile registered at the bank. If his profile is "Admin", he returns another page. I try with the Administrator profile and it works, already from another user, I changed his profile in the bank and does not return the right profile.

Can anyone help me? My code is this:

 public ActionResult LogOn(FormCollection f, string returnUrl)
        {
            Conta user = new Conta();
            ContaModels atrrConta = new ContaModels();
            atrrConta = user.RetornaUser(f["login"]);
            if (user.AutenticaUser(atrrConta, f["senha"]))
            {
                //Rotina para autenticar usuario
                if (returnUrl == "" || returnUrl == null)
                {
                    returnUrl = "../CalendarioAlertaSMS";
                }
                System.Web.Security.FormsAuthentication.SetAuthCookie(f["login"], false);

                Session["PERFIL"] = atrrConta.Ide_Perfil;
                if (Session["PERFIL"].ToString() == "ADMIN")
                {
                    returnUrl = "../PainelAdm";
                }

                return Redirect(returnUrl);
            }
            else {
                ViewBag.Message = "Login ou senha inválidos.";
                return View(); 
            }
        }
    
asked by anonymous 23.06.2015 / 20:19

1 answer

2

try to use this in place of redirect:

return RedirectToAction("NomeDaAction");
    
23.06.2015 / 20:30