asp.net mvc - Why can't MVC find my view correctly? -
i'm working on mvc5.
i have controllers , respective views. if click on view , open on browser, everything's fine, however, whenever start project on vs, browser opens, example, link:
http://localhost:50738/views/profile/index.cshtml
however, whenever open view directly have:
http://localhost:50738/profile or http://localhost:50738/profile/index
at routeconfig file said wanted profile shown default, instead of home. why '/views/' appear on browser?
code:
namespace worktimemanager.presentation { 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 = "indicators", action = "index", id = urlparameter.optional } ); } } }
its because have start action set current page in web project. when start web app try load page viewing in visual studio.
to fix this, right click web project in solution , click properties, click on web , see start action - current page radio button selected.
change specific page , type in homepage url e.g. http://localhost:50738/index everytime start web app visual studio open on page instead of trying open current page.
Comments
Post a Comment