我正在浏览Lynda.com ASP.NET MVC 5 Essentials课程,当我无处可去的时候,当我尝试查看我的网站时,我开始出现简单的HTML。我尝试过不同的浏览器而没有运气。知道是什么原因造成的吗?
编辑:我应该注意,我根本没有收到任何错误。
我会抛弃我的一些代码,但我不能100%确定哪些部分是相关的。
index.cshtml:
@{
ViewBag.Title = "Home Page";
}
<div class="row">
<div class="col-md-6 margin-top-20">
<a href="#" class="btn btn-primary btn-lg btn-block">
<span class="glyphicon glyphicon-circle-arrow-down">Withdrawal
</span>
<span class="glyphicon glyphicon-print">
Print Statement
</span>
<span class="glyphicon glyphicon-transfer">
Withdrawal
</span>
<span class="glyphicon glyphicon-circle-arrow-up">
Deposit
</span>
</a>
</div>
<div class="col-md-6 margin-top-20"></div>
}
HomeController.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace AutomatedTellerMachine.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
return View();
}
[ActionName("about-this-atm")]
public ActionResult About()
{
return View();
}
public ActionResult Contact()
{
ViewBag.TheMessage = "Having trouble? Send us a message!";
return View();
}
public ActionResult Foo()
{
return View("About");
}
public ActionResult Serial(string letterCase)
{
var serial = "ASPNETMVC5ATM1";
if (letterCase == "lower")
{
return Content(serial.ToLower());
}
return Json(new { name = "serial", ValueProvider = serial }, JsonRequestBehavior.AllowGet);
}
[HttpPost]
public ActionResult Contact(string message)
{
// TODO : send message to HQ
ViewBag.Message = "Thanks, we got your message!";
return View();
}
}
}
Layout.cshtml:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - MVC Bank</title>
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
@Html.ActionLink("MVC Bank", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>@Html.ActionLink("Home", "Index", "Home")</li>
<li>@Html.ActionLink("About", "About", "Home")</li>
<li>@Html.ActionLink("Contact", "Contact", "Home")</li>
</ul>
@Html.Partial("_LoginPartial")
</div>
</div>
</div>
<div class="container body-content">
@RenderBody()
<hr />
<footer>
<p>© @DateTime.Now.Year - MVC Bank - @Html.Action("Serial", "Home")</p>
</footer>
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)
</body>
</html>
这就是我在浏览器中看到的内容:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Home Page - MVC Bank</title>
<link href="/Content/bootstrap.css" rel="stylesheet"/>
<link href="/Content/site.css" rel="stylesheet"/>
<script src="/Scripts/modernizr-2.6.2.js"></script>
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">MVC Bank</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="/">Home</a></li>
<li><a href="/Home/About">About</a></li>
<li><a href="/Home/Contact">Contact</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="/Account/Register" id="registerLink">Register</a></li>
<li><a href="/Account/Login" id="loginLink">Log in</a></li>
</ul>
</div>
</div>
</div>
<div class="container body-content">
<div class="row">
<div class="col-md-6 margin-top-20">
<a href="#" class="btn btn-primary btn-lg btn-block">
<span class="glyphicon glyphicon-circle-arrow-down">Withdrawal
</span>
<span class="glyphicon glyphicon-print">
Print Statement
</span>
<span class="glyphicon glyphicon-transfer">
Withdrawal
</span>
<span class="glyphicon glyphicon-circle-arrow-up">
Deposit
</span>
</a>
</div>
<div class="col-md-6 margin-top-20"></div>
</div>
}
<hr />
<footer>
<p>© 2016 - MVC Bank - {"name":"serial","ValueProvider":"ASPNETMVC5ATM1"}</p>
</footer>
</div>
<script src="/Scripts/jquery-1.10.2.js"></script>
<script src="/Scripts/bootstrap.js"></script>
<script src="/Scripts/respond.js"></script>
</body>
</html>