首页 > 其他 > 详细

The view or its master was not found or no view engine supports the searched locations

时间:2019-12-19 10:34:29      阅读:109      评论:0      收藏:0      [点我收藏+]

Error like:The view ‘LoginRegister‘ or its master was not found or no view engine supports the searched locations. The following locations were searched:

~/Views/MyAccount/LoginRegister.aspx

~/Views/MyAccount/LoginRegister.ascx

~/Views/Shared/LoginRegister.aspx

~/Views/Shared/LoginRegister.ascx

~/Views/MyAccount/LoginRegister.cshtml

~/Views/MyAccount/LoginRegister.vbhtml

~/Views/Shared/LoginRegister.cshtml

~/Views/Shared/LoginRegister.vbhtml

Actually my page view page is ~/Views/home/LoginRegister.cshtml so what i do

and my RouteConfig is

 public class RouteConfig
    {

        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "MyAccount", action = "LoginRegister", id = UrlParameter.Optional }
            );
        }
    }

第一种方法:

public ActionResult LoginRegiseter()
{
  return View("LoginRegiseter");
}

 

第二种方法:

 

public ActionResult LoginRegiseter()
{
  return View("~/Views/MyAccount/LoginRegiseter.cshtml");
}

The view or its master was not found or no view engine supports the searched locations

原文:https://www.cnblogs.com/googlegis/p/12065826.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!