Results 1 to 7 of 7

Thread: [RESOLVED] Error: "The view 'Index' or its master was not found or no view engine supports ..."

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2009
    Posts
    230

    Resolved [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

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    Jun 2009
    Posts
    230

    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?

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    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?

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Jun 2009
    Posts
    230

    Re: Error: "The view 'Index' or its master was not found or no view engine supports .

    Quote Originally Posted by jmcilhinney View Post
    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.

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    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.

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Jun 2009
    Posts
    230

    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.

  7. #7
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    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
  •  



Click Here to Expand Forum to Full Width