Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I'm following a tutorial on how to build a website with MVC. I created the project as Web under C#, then chose Empty from ASP.Net 4.6.1 Templates and chose the option MVC.

I created two new folders and added bootstrap, CSS, and fonts files to these new folders.

I also created a new folder under View folder and then added Layout Page (Razor v3).


Then after I added the following code

------------------------------------------------------

<pre><title>@Page.Title</title>

    <link href="~/Content/bootstrap.min.css" rel="stylesheet" />
</head>
<body>

    <!--Navbar-->
    <Nav class="navbar navbar-default navbar-fixed-top">
        <div class="container">

            <div class="row">

                <div class="col-sm-4">.col-sm-4</div>
                <div class="col-sm-4">.col-sm-4</div>
                <div class="col-sm-4">.col-sm-4</div>
            </div>

            <div class="navbar-header">
                <button class="navbar-toggle collapsed" data-toggle="collapase"
                        data-target="#navbar">
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>

                </button>
                <a href="#" class="navbar-brand">
                    <img src="" />
                </a>

            </div>

            <div id="navbar" class="navbar-collapse">
                <ul class="nav navbar-nav">
                    <li>
                        <a href="#">
                            
                            Food Menu
                        </a>
                    </li>

                    <li>
                        <a href="#">
                            ^__i class="glyphicon glyphicon-home">
                            Registeration
                        </a>
                    </li>
                    <li>
                        <a href="#">
                            ^__i class="glyphicon glyphicon-home">
                            About
                        </a>
                    </li>


                </ul>
            </div>
        </div>

    </Nav>

    @RenderBody()

    <!--Footer-->
    <script src="~/Scripts/jquery.js"></script>
    <script src="~/Scripts/bootstrap.min.js"></script>

   
</body>
</html>



------------------------------------------

I got the following error

Server Error in '/' Application.
HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.

What I have tried:

I have searched and found many answers, but most of them are hard to follow, so I could not solve the issue. Please guide me to solve the problem.
Posted
Updated 31-May-18 18:13pm
Comments
[no name] 30-May-18 16:27pm    
There are "good" and "bad" tutorials.

You obviously picked a bad one.

https://mva.microsoft.com/en-us/training-courses/introduction-to-aspnet-mvc-8322?l=nKZwZ8Zy_3504984382
Ameen Shamsan 31-May-18 18:39pm    
Thank you.
Jinto Jacob 31-May-18 1:11am    
the error may not be in this page. most probably it is in your route configuration or controller.
Ameen Shamsan 31-May-18 18:39pm    
Could you please guide me to solve this issue. How to set route configuration?

Thank you.

1 solution

Can you please check the location of index.cshtml file( or your view). it should be under the views folder in a sub-folder called home or in a sub-folder named with your controller name. If you place it on a different location the error can occur.

check this article[^]

you can get a detailed tutorial in many websites. The below one is very useful

Click here for the tutorial link[^]
 
Share this answer
 
v4

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