我周五离开了,我的应用程序在开发模式下工作....我今天早上进来,Layout.Mobile.chtml没有被使用。 ....这是开发模式,所以我仍然每次启动Web服务器....我阅读了有关缓存的类似问题....但我不明白这可能与我的问题有关,因为一旦Web服务器关闭,高速缓存被清除。Layout.mobile.cshtml突然停止工作 - 不应该与缓存相关
我使用Visual Studio 2012作为我的开发“Web服务器”。
一切都在运行,我看不出问题出在哪里,也不理解下一步要看的地方。任何建议如何诊断这个问题或在哪里看,将不胜感激。
这是只为Layout.Mobile.cshtml ....当我切换回Layout.cshtml它被称为精细....
在我的global.asax.cs我有下面设置为强制火狐使用移动布局来显示:
//The following forces Firefox to use the Mobile View ONLY
DisplayModeProvider.Instance.Modes.Insert(0, new DefaultDisplayMode("mobile")
{
ContextCondition = (context =>
context.Request.UserAgent.IndexOf("Mozilla", StringComparison.OrdinalIgnoreCase) >= 0)
});
我_ViewStart.cshtml文件是:
@{
Layout = "~/Views/Shared/_Layout.cshtml";
}
我_Layout.Cshtml是:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>@ViewBag.Title - Etracs</title>
<link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<meta name="viewport" content="width=device-width" />
@Styles.Render("~/Content/css")
<script src="~/Scripts/jquery-1.9.1.js"></script>
<script src="~/Scripts/jquery-migrate-1.1.1.js"></script>
@RenderSection("scripts", required: false)
</head>
<body>
<header>
*@
</header>
<div id="body">
<section class="content-wrapper main-content clear-fix">
@RenderBody()
</section>
</div>
@Html.Partial("_ViewSwitcher")
<footer>
<div class="content-wrapper">
<div class="float-left">
<p>© @DateTime.Now.Year - Turning Basin Services</p>
</div>
</div>
</footer>
</body>
</html>
我_Layout.Mobile.cshtml是:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>@ViewBag.Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
@* @Styles.Render("~/Content/Mobile/css") *@
@* @Styles.Render("~/Content/jquerymobile/css") *@
<link rel="stylesheet" href="~/Content/Mobile/css/jquery.mobile-1.2.0.css" />
<link rel="stylesheet" href="~/Content/Mobile/css/jquery.mobile.theme-1.2.0.css" />
@* @Scripts.Render("~/bundles/jquery") *@
@* @Scripts.Render("~/bundles/jquerymobile") *@
<script src="~/Scripts/jquery-1.9.1.js"></script>
<script src="~/Scripts/jquery-migrate-1.1.1.js"></script>
<script src="~/Scripts/jquery.mobile-1.2.0.js"></script>
<script>
$(document).ready(function() {
$.mobile.ajaxEnabled = false;
});
</script>
@RenderSection("scripts", required: false)
</head>
<body>
<div data-role="page" data-theme="c">
<div data-role="header">
@RenderSection("backbtn", false)
<h1>@ViewBag.Title</h1>
@RenderSection("Home", false)
</div>
<div data-role="content">
@* @RenderSection("featured", false) *@
@RenderBody()
</div>
<div data-role="footer">
<h4> @Html.Partial("_ViewSwitcher") © @DateTime.Now.Year - Turning Basin Services</h4>
</div>
</div>
</body>
</html>
在我的意见,我通常使用viewstart建立以impliclity地图布局....但是,我.Login.Mobile .cshtml硬线assocaiation到移动布局如下:
@model TBS.Etracs.Web.Main.Models.LoginModel
@{
ViewBag.Title = "Log in";
Layout = "~/Views/Shared/_Layout.Mobile.cshtml";
}
@Html.ValidationSummary(true)
<section id="loginForm">
@* @using (Html.BeginForm(new { ReturnUrl = ViewBag.ReturnUrl })) { *@
@using (Html.BeginForm ("Login")) {
@Html.AntiForgeryToken()
<div data-role="content">
<div data-role="fieldcontain">
<label for="UserName">UserName:</label>
@Html.TextBoxFor(m => m.UserName)
@Html.ValidationMessageFor(m => m.UserName)
</div>
<div data-role="fieldcontain">
<label for="Password">Password</label>
@Html.PasswordFor(m => m.Password)
@Html.ValidationMessageFor(m => m.Password)
</div>
<div data-role="fieldcontain">
<label for="ProgramMode">ProgramMode</label>
<select name="ProgramMode" id="ProgramMode">
<option value="VW">VW</option>
<option value="Porsche">Porsche</option>
<option value="Bentley">Bentley</option>
</select>
</div>
<div data-role="fieldcontain">
<label for="ConnectionMode">ConnectionMode</label>
<select name="ConnectionMode" id="ConnectionMode">
<option value="Production">Production</option>
<option value="Test">Test</option>
</select>
</div>
<input type="submit" value="Log in" />
</div>
}
</section>
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}
我刚刚确认我有FixedDisplayModes nuge t包安装.... – user2040849