Jquery 如果用户未通过MVC身份验证,则显示引导模式窗口
当用户未在我的应用程序中进行身份验证时,我试图显示一个引导模式窗口 它似乎不起作用 当我点击上传文件的按钮时,它会调用jQuery脚本并检查用户是否经过身份验证 我试过了-Jquery 如果用户未通过MVC身份验证,则显示引导模式窗口,jquery,asp.net-mvc,asp.net-mvc-4,twitter-bootstrap,Jquery,Asp.net Mvc,Asp.net Mvc 4,Twitter Bootstrap,当用户未在我的应用程序中进行身份验证时,我试图显示一个引导模式窗口 它似乎不起作用 当我点击上传文件的按钮时,它会调用jQuery脚本并检查用户是否经过身份验证 我试过了- <a id="upload-card" class="btn btn-success btn-large">Upload a Ranger Card</a> <script type="text/javascript"> $(function () { $('#
<a id="upload-card" class="btn btn-success btn-large">Upload a Ranger Card</a>
<script type="text/javascript">
$(function () {
$('#upload-card').click(function () {
if ("@Request.IsAuthenticated" == false) {
$('#modal-authentication').modal("show");
}
else {
window.location.href = "/Upload/Account/";
}
});
});
</script>
<div id="modal-authentication" class="modal hide fade" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
×</button>
<h3 id="myModalLabel">
Modal header</h3>
</div>
<div class="modal-body">
<center>@Html.Partial("_SharedLogOn")</center>
</div>
</div>
上传一张游侠卡
jQuery-
<a id="upload-card" class="btn btn-success btn-large">Upload a Ranger Card</a>
<script type="text/javascript">
$(function () {
$('#upload-card').click(function () {
if ("@Request.IsAuthenticated" == false) {
$('#modal-authentication').modal("show");
}
else {
window.location.href = "/Upload/Account/";
}
});
});
</script>
<div id="modal-authentication" class="modal hide fade" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
×</button>
<h3 id="myModalLabel">
Modal header</h3>
</div>
<div class="modal-body">
<center>@Html.Partial("_SharedLogOn")</center>
</div>
</div>
$(函数(){
$(“#上传卡”)。单击(函数(){
如果(“@Request.IsAuthenticated”==false){
$(“#模态身份验证”).modal(“show”);
}
否则{
window.location.href=“/Upload/Account/”;
}
});
});
引导模式窗口-
<a id="upload-card" class="btn btn-success btn-large">Upload a Ranger Card</a>
<script type="text/javascript">
$(function () {
$('#upload-card').click(function () {
if ("@Request.IsAuthenticated" == false) {
$('#modal-authentication').modal("show");
}
else {
window.location.href = "/Upload/Account/";
}
});
});
</script>
<div id="modal-authentication" class="modal hide fade" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
×</button>
<h3 id="myModalLabel">
Modal header</h3>
</div>
<div class="modal-body">
<center>@Html.Partial("_SharedLogOn")</center>
</div>
</div>
×
模态头
@Html.Partial(“\u SharedLogOn”)
帮我解决这个问题。你能这样试试吗-
if ('@Request.IsAuthenticated' == 'False')
为什么在出现
false
的情况下不发生这种情况?