I'm wondering why for one of my views I get the error "Section not defined: "featured2"". The path to the layout is correct, and I define the featured2 section in the view.


@using System.Data;
@using System.Data.SqlClient;
ViewBag.Title = "Attempted Unauthorized Access";
Layout = "../Shared/Layout2.cshtml";
string whoareyoupeople = User.Identity.Name.ToString();
DateTime date = DateTime.Now;
string myerrorstring = "User " + whoareyoupeople + " attempted unauthorized access on " + date + ".";

    string fileName = "C:\\BillingExport\\SECURITY\\seclog.txt";
    using (FileStream fs = new FileStream(fileName, FileMode.Append, FileAccess.Write)){
    using (StreamWriter sw = new StreamWriter(fs))
@section featured2 {
<center><h2 style="color:red">Access Denied for user @User.Identity.Name. You are not authorized to view this application.</h2></center>


ViewBag.Title = "Layout2";

<link runat="server" rel="icon" href="../Content/images/eifavicon.ico" type="image/x-icon" />
@RenderSection("scripts", required: false)
                                         browsername = navigator.appName;
                                         if (browsername.indexOf("Microsoft") != -1) {
                                             browsername = "MSIE";
                                             document.write("<p id='indent2'>You're viewing this page using Internet Explorer. Please use a supported browser (<a href='https://www.google.com/chrome/browser/'>Chrome</a>, <a href='https://www.mozilla.org/en-US/firefox/new/'>Firefox</a>)</p>");


Related posts

Recent Viewed