jeudi 11 juin 2015

The controller for path '/GlobalAdmin/GlobalAdmin/IndexGlobalAdmin' was not found or does not implement IController

I have the following structure:

One area called global admin, the area has a global admin controller, and its view

http://ift.tt/1QrCvfO

My code is as follows:

GlobalAdminController:

namespace Inspinia_MVC5.Areas.GlobalAdmin.Controllers
{
    [AuthorizeUser(Roles = "admin")]
    public class GlobalAdminController : Controller
    {
        // GET: GlobalAdmin

        public ActionResult IndexGlobalAdmin()
        {
            return View();
        }
    }
}

and on my home controller I have the following:

 public class HomeController : Controller
    {
        public ActionResult Index()
        {
            if (User.IsInRole("admin"))
            {
                return RedirectToAction("IndexGlobalAdmin", "GlobalAdmin", new { area = "GlobalAdmin" });
            }
            if (User.IsInRole("Company Admin"))
            {
                return RedirectToAction("Index", "CompanyAdmin", new { area = "CompanyAdmin" });
            }
            return View();
        }

the index view is easy

@{
    Layout = "~/Areas/GlobalAdmin/Views/Shared/_LayoutGlobalAdmin.cshtml";
    ViewBag.Title = "Index";
}

<h2>Index</h2>

However I get this error:

The controller for path '/GlobalAdmin/GlobalAdmin/IndexGlobalAdmin' was not found or does not implement IController

What is my problem?

Aucun commentaire:

Enregistrer un commentaire