Redirect to Area controller action method from main Controller actionmethod

982 views Asked by At

I am using ASP.NET MVC with Areas and want to follow these procedure:

On load the application my first page will come login that is from main controller action result (Controller from main solutions explorer not Areas)

Suppose I have AccountController when I load the application my first page login post will call httppost of main controller actionmethod Login.

Here in Login controller I want to redirect to areas controller as per login done:

AccountController:

public ActionResult LoginEmployee(string Name, string Password)
        {
            if (Name == "Admin")
            {
                return RedirectToAction("Index", "AdminHome", new { Area = "Admin" });
            }
            else
            {
                return RedirectToAction("Index", "CustomerHome", new { Area = "Customer" });
            }
        }

But this code is not returning to Areas controller nothing happen may be I am doing anything wrong or something error.

Please tell me if anything wrong.

Thanks in advance.

0

There are 0 answers