1

If you have created a controller like:

public class ProjectLoginController : Controller
{
    /// <summary>
    /// GET: /login
    /// </summary>
    /// <returns></returns>
    [HttpGet]
    [AllowAnonymous]
    public ActionResult Login()
    {
        return View();
    }
}

It will search for the login view in the ProjectLogin or the Shared folder.

Is it possible to tell MVC for this controller to search in the views folder Account under Viewsinstead of doing:

return View("~/Views/Account/Login.cshtml");

or:

return View("../Account/Login");
Mivaweb
  • 5,580
  • 3
  • 27
  • 53

2 Answers2

1

You can use RedirectToAction() method for this. For example,

return RedirectToAction("LogIn", "Account");

Or-else, do like this,

return View("../Account/Login");

Hoe it helps :)

Basanta Matia
  • 1,504
  • 3
  • 15
  • 27
0

Yes you can do this by following ways:

return View("../Account/Login");

or

return RedirectToAction("LogIn", "Account");
Jaimin Dave
  • 1,224
  • 10
  • 18