避免在asp.net-mvc中使用_Layout-cshtml
这是my_ViewStart.cshtml:避免在asp.net-mvc中使用_Layout-cshtml,asp.net,.net,angularjs,asp.net-mvc,url-routing,Asp.net,.net,Angularjs,Asp.net Mvc,Url Routing,这是my_ViewStart.cshtml: @{ Layout = "~/Views/Shared/_Layout.cshtml"; } 这是my_Layout.html: <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.
@{
Layout = "~/Views/Shared/_Layout.cshtml";
}
这是my_Layout.html:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - My ASP.NET Application</title>
<link href="//netdna.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<!-- Lots of tags for dependencies -->
</head>
<body>
<div class="container body-content">
@RenderBody()
<div class="divider row top-buffer"></div>
<footer>
<p>© @DateTime.Now.Year - MyApp</p>
</footer>
</div>
</body>
</html>
由于我在Angular$routeProvider
中使用客户端路由,所以我总是使用Index.cshtml。此外,我不需要布局,我只需要Index.cshtml
在浏览器中转到本地主机时,如何避免使用布局文件并直接从my Index.cshtml开始?您可以将
布局设置为null,然后您将只看到Index.cshtml视图
@{
Layout = null;
}
按以下方式使用空布局:
@{
Layout = null;
}
这等于我的回答,然后我会自动从Index.cshtml开始?@testiguy是的,你可以start@testiguy你们试过了吗?你们解决问题了吗
@{
Layout = null;
}
@{
Layout = null;
}