Click here to Skip to main content
15,895,798 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am trying to render page layout in my index page in mvc project. here is the code:
_ViewStart.cshtml
C#
@{
    Layout = "~/Views/Shared/_Layout.cshtml";
}


index.cshtml
C#
@{
    Layout = "~/Views/Shared/_Layout.cshtml";
}


the _Layer.cshtml page exists in the given folder i.e is shared folder. but when i run the project i gives an error.
CSS
Server Error in '/' Application.
The layout page "~/View/Shared/_Layout.cshtml" could not be found at the following path: "~/View/Shared/_Layout.cshtml".
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: The layout page "~/View/Shared/_Layout.cshtml" could not be found at the following path: "~/View/Shared/_Layout.cshtml".



i have tried to use ~/shared/_Layout.cshtml syntax. but of use
Can somebody please tell me what i need to do.
Posted

1 solution

Move _Layout.cshtml file into View main folder :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900