-
Dec 30th, 2012, 07:32 AM
#1
Thread Starter
Addicted Member
[RESOLVED] Error: "The view 'Index' or its master was not found or no view engine supports ..."
Hello, I've been following a tutorial in developing an MVC shopping cart but I get the following error when i try to access the controller class:
The view 'Index' or its master was not found or no view engine supports the searched locations. The following locations were searched:
~/Views/ShoppingCart/Index.aspx
~/Views/ShoppingCart/Index.ascx
~/Views/Shared/Index.aspx
~/Views/Shared/Index.ascx
~/Views/ShoppingCart/Index.cshtml
~/Views/ShoppingCart/Index.vbhtml
~/Views/Shared/Index.cshtml
~/Views/Shared/Index.vbhtml
The url looks ok but it's not picking up the right file I think: http://localhost:1565/ShoppingCart/Index
The tutorial is found here: http://www.asp.net/mvc/tutorials/mvc...c-store-part-8
Please will someone advice.
Thanks,
Garry
-
Dec 30th, 2012, 07:44 AM
#2
Thread Starter
Addicted Member
Re: Error: "The view 'Index' or its master was not found or no view engine supports .
Ok, I've added the view to the shared folder of the Views folder and the view works now but why won't it world from the top level folder?
-
Dec 30th, 2012, 09:01 AM
#3
Re: Error: "The view 'Index' or its master was not found or no view engine supports .
~/Views/ShoppingCart/Index.aspx
~/Views/ShoppingCart/Index.ascx
~/Views/Shared/Index.aspx
~/Views/Shared/Index.ascx
~/Views/ShoppingCart/Index.cshtml
~/Views/ShoppingCart/Index.vbhtml
~/Views/Shared/Index.cshtml
~/Views/Shared/Index.vbhtml
It should be at one of the paths I've highlighted. Was it?
-
Dec 30th, 2012, 09:05 AM
#4
Thread Starter
Addicted Member
Re: Error: "The view 'Index' or its master was not found or no view engine supports .
Originally Posted by jmcilhinney
It should be at one of the paths I've highlighted. Was it?
I'm not sure what you mean. I placed the view in the Views>Shared folder and it worked but if i place in the Views folder I get the error. This is the URL I use: http://localhost:1565/ShoppingCart/Index or http://localhost:1565/ShoppingCart/Index.
-
Dec 30th, 2012, 09:15 AM
#5
Re: Error: "The view 'Index' or its master was not found or no view engine supports .
The error message tells you which file paths were searched for the view. Are any of those paths in the Views folder? No they are not, so obviously your view should not be in the views folder. Look at the ones I've highlighted. Those are the only ones reasonable for your view. Are any of them in the Shared folder? No they are not, so obviously your view should not be in the Shared folder. It's not shared is it? It's only used by one controller isn't it? It should be in the folder that corresponds to that controller, as I have demonstrated by highlighting the valid paths.
-
Dec 30th, 2012, 09:27 AM
#6
Thread Starter
Addicted Member
Re: Error: "The view 'Index' or its master was not found or no view engine supports .
Thanks mate! This makes a more sense now I've added the ShoppingCart directory in the views folder.
-
Dec 30th, 2012, 09:48 AM
#7
Re: [RESOLVED] Error: "The view 'Index' or its master was not found or no view engine
I haven't looked at the tutorial you were using but you should be simply right-clicking on the action name and selecting Add View and it will create it in the right place for you.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|