2

Hello I am starting to learn in web programming language using asp.net mvc4 and bootstrap. I am getting this error (Server Error in '/' Application) when running my application but if it is in default code it is functioning fine.

These are my codes

_ViewStart.cshtml

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

I didn't change anything here

_Layout.cshtml

    <!DOCTYPE html>
<html lang="en">
    <head>
       <meta charset="utf-8" content="" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name="description" content="" />
    <meta name="author" content="Corinthians 3" />

        <title>Sample BS</title>
   <!-- Bootstrap Core CSS -->
    <link href="@Url.Content("~/plugin/bower_components/bootstrap/dist/css/bootstrap.min.css")" rel="stylesheet" type="text/css" />

    <!-- MetisMenu CSS -->
    <link href="@Url.Content("~/plugin/bower_components/metisMenu/dist/metisMenu.min.css")" rel="stylesheet" type="text/css" />

    <!-- DataTables CSS -->
    <link href="@Url.Content("~/plugin/bower_components/datatables-plugins/integration/bootstrap/3/dataTables.bootstrap.css")" rel="stylesheet" type="text/css" />

    <!-- Animation CSS -->
    <link href="@Url.Content("~/plugin/css/animate.css")" rel="stylesheet" type="text/css" />    

    <!-- Custom CSS -->
    <link href="@Url.Content("~/plugin/dist/css/sb-admin-2.css")" rel="stylesheet" type="text/css" />

    <!-- Custom Fonts -->
    <link href="@Url.Content("~/plugin/bower_components/font-awesome/css/font-awesome.min.css")" rel="stylesheet" type="text/css" />

    <link href="../../plugin/dateTimePicker/css/bootstrap-datetimepicker.css" rel="stylesheet" type="text/css" />    
</head>
    <body>
        <div id="wrapper">
    <div>
        <label for="disabledSelect" style="color:#A94442; display:none;" id="lblTotalCollectibles"></label>
    </div>
        <!-- Navigation -->
        <nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0; background-color:#337AB7;">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                    < span class="sr-only"> Toggle navigation < /span >
                    < span class="icon-bar">< /span >
                    < span class="icon-bar">< /span >
                    < span class="icon-bar">< /span >
                </button>
                <a class="navbar-brand" href="@Url.Content("~/BS/BSSSS")" style="color:White;">BS</a>
            </div>
            <!-- /.navbar-header -->

            <ul class="nav navbar-top-links navbar-right">
                <li style="margin-top:13px;">
                    <span class="fa fa-clock-o" style="color:White;" id="timeTxt"></span>
                </li>  
            </ul>
            <!-- /.navbar-top-links -->

            <div class="navbar-default sidebar" role="navigation">
                <div class="sidebar-nav navbar-collapse">
                    <ul class="nav" id="side-menu">                        
                        <li>

                        </li>  
                        <li> <!--style="display:none;"> -->

                        </li> 
                        <li> <!--style="display:none;"> -->

                        </li>
                        <li>
                            <a href="#"><i class="fa fa-wrench fa-fw" id="side-menu-filemaintenance"></i> File Maintenance <span class="fa arrow"></span></a>
                            <ul class="nav nav-third-level">
                                <li>

                                </li>
                                <li>

                                </li>
                            </ul>
                            <!-- /.nav-third-level -->
                        </li>                  
                    </ul>
                </div>
                <!-- /.sidebar-collapse -->
            </div>
            <!-- /.navbar-static-side -->
        </nav>
        <!-- Page Content -->
        <div id="page-wrapper" style="background-image:url(../../Images/bg.gif); background-attachment: fixed;">
            <div class="container-fluid">
                @RenderBody()
            </div>
            <!-- /.container-fluid -->
        </div>
        <!-- /#page-wrapper -->
    </div>
    <!-- /#wrapper -->

    <!-- jQuery -->
    <script src="@Url.Content("~/plugin/bower_components/jquery/dist/jquery.min.js")" type="text/javascript"></script>

    <!-- Bootstrap Core JavaScript -->
    <script src="@Url.Content("~/plugin/bower_components/bootstrap/dist/js/bootstrap.min.js")" type="text/javascript"></script>

    <!-- Metis Menu Plugin JavaScript -->
    <script src="@Url.Content("~/plugin/bower_components/metisMenu/dist/metisMenu.min.js")" type="text/javascript"></script>

    <!-- DataTables JavaScript -->
    <script src="@Url.Content("~/plugin/bower_components/datatables/media/js/jquery.dataTables.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/plugin/bower_components/datatables-plugins/integration/bootstrap/3/dataTables.bootstrap.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/plugin/js/jquery.scrollUp.min.js")" type="text/javascript"></script>    

    <script src="../../plugin/dateTimePicker/js/moment-with-locales.js" type="text/javascript"></script>
    <script src="../../plugin/dateTimePicker/js/bootstrap-datetimepicker.js" type="text/javascript"></script>

    <!-- Custom Theme JavaScript -->
    <script src="@Url.Content("~/plugin/dist/js/sb-admin-2.js")" type="text/javascript"></script>


    <script src="@Url.Content("~/Scripts/userdefined/Sales/jsSales.js")" type="text/javascript"></script>
    </body>
</html>

And Lastly for my View>BS>BSSSS.cshtml

@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title></title>
</head>
<body>
    <div>
    <h1>aaaa</h1>
    </div>
</body>
</html>

Here is the picture of the error.

UPDATED

@Gaurav here is the new error that i follow your suggested way.

NEW

15
  • See this post: stackoverflow.com/questions/10971149/… Commented Sep 20, 2016 at 5:39
  • @GauravSinghJantwal wait2 i start to read it. Commented Sep 20, 2016 at 5:41
  • @GauravSinghJantwal we have same error but the suggested answer said @RenderSection("scripts") but I don't have that kind of code. Commented Sep 20, 2016 at 5:47
  • I created new project and copied the same code, it worked, without any glitch. You don't have any @RenderSection("featured", required: false), in your layout page, so this error should not be raised. Commented Sep 20, 2016 at 6:16
  • I guess, some other action is called, kindly check some Index action.. like Home/Index. Because your image shows that clearly you are not calling BS/BSSSS i.e. controller BS and action BSSSS Commented Sep 20, 2016 at 6:18

1 Answer 1

1

Approach 1

Rename your BSSSS.cshtml to Index.cshtml and move it to Views/Home folder (replace existing file). Leave the statement as return View(); in Home controller's Indexaction.

Approach 2

Let the BSSSS.cshtml file remain at path Views/BS/BSSSS.cshtml. In your Home controller's Index action change the return View(); to return View("BSS/BSSSS.cshtml");

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.