J.C
J.C

Reputation: 752

Redirect not working asp.net mvc error 404 despite having the correct location

I want to redirect to a new page after login. However it does not work.

here is my code for the login check.

    [HttpPost]
    public ActionResult Index([Bind] EmployeModel employe)
    {
        bool employeExiste = employe.LoginCheck(employe);

        if (employeExiste)
        {
            return RedirectToAction("../InventoryLocation/Index");
        }
        else
        {
            TempData["msg"] = "Your password is wrong!";
            return View();
        }

    }

Here is my file structure. File structure

Here is my 404 error.

error 404

I am new to mvc what am I missing? Thank you for your help.

Upvotes: 0

Views: 295

Answers (1)

Mahdi Anjam
Mahdi Anjam

Reputation: 298

change return value to:

return RedirectToAction("Index","InventoryLocation");

and check InventoryLocation to ininheritance Controller

Upvotes: 2

Related Questions