i am new in mvc.i created one mvc project in VS2013. so just seen the home controller code and saw there are few action function like
public ActionResult About()
{
ViewBag.Message = "Your app description page.";
return View();
}
public ActionResult Contact()
{
ViewBag.Message = "Your contact page.";
return View();
}
when contact or about action will be called then how asp.net mvc engine will understand which view need to show? and from where to load the view file because view file could be in different folder too.
if i need to show view file in different folder then how could i specify in view() function ? do i need to specify the view path ? or i can give any view name in view function which can load view file from other folder.
when few view file is in same folder then we do not need to specify path? can we specify view name only if view name is not same as action method name.
suppose my view file name is MyAbout.cshtml
. so when about action will be called then i can specify name only not path like below
public ActionResult About()
{
ViewBag.Message = "Your app description page.";
return View("MyAbout");
}
thanks