I have the project structure (see below). When I launch the project I get this error (see below). Could you tell me the change I have to do, I'd like when I start the project go to MyAreas1\Home
Thanks,
Error message : The view 'Index' or its master was not found or no view engine supports the searched locations. The following locations were searched:
~/Views/Home/Index.aspx
~/Views/Home/Index.ascx
~/Views/Shared/Index.aspx
~/Views/Shared/Index.ascx
~/Views/Home/Index.cshtml
~/Views/Home/Index.vbhtml
~/Views/Shared/Index.cshtml
~/Views/Shared/Index.vbhtml
On basis of data transfer mechanism ASP.NET MVC views are categorized as two types, Dynamic view. Strongly typed view.
Right-click your Project within the Solution Explorer. Choose Properties. Select the Web tab on the left-hand side. Under the Start Action section, define the Specific Page you would like to default to when the application is launched.
The Default route maps the first segment of a URL to a controller name, the second segment of a URL to a controller action, and the third segment to a parameter named id. The Default route maps this URL to the following parameters: controller = Home. action = Index.
You must set specified routing in Global.asax
file
routes.MapRoute(
"Default", // Route name
"MyArea1/{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
So what you need is to edit your default route.
Try right click on the project >> properties>> Web>> now check Specific Page option and type the controllerName/ActionName
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With