How can I get a page redirected correctly using RedirectToAction?

0

I am making a login to access a project that has already been developed but I have had problems in how to have the RedirectToAction because it throws me the following error:

The Sidcar view is in the Home folder, but I do not know why it throws this error. The code of the controller is as follows:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Security;

namespace ProyectoDicar.Controllers
{
    public class UserController : Controller
    { 
        //
        // GET: /User/
        public ActionResult Index()
        {
            return View();
        }

        [HttpGet]
        public ActionResult Login()
        {
            return View();
        }

        private const string ControllerName = "Sidcar";
        Boolean boolean = false;
        [HttpPost]
        public ActionResult Login(Models.User user)

        {

            if (ModelState.IsValid)
            {
                if (user.IsValid(user.UserName, user.Password))
                {
                    boolean = true;

                }
                else
                {
                    ModelState.AddModelError("", "Login data is incorrect!");
                }
            }
            if (boolean == true)
            {
                return RedirectToActionPermanent ("Sidcar", "Home");
            }
            return View( );
        }
        public ActionResult Logout()
        {
            FormsAuthentication.SignOut();
            return RedirectToAction("Index", "Home");
        }
        public ActionResult Sidcar ()
        {
            return View();
        }
    }
}

I appreciate your collaboration

    
asked by Jager Rubio 10.05.2018 в 14:46
source

0 answers