我正在尝试将以下 Javascript 代码从 C# razor 转换为在 Vbhtml 中使用它。当我在我的 vb.net 环境中插入代码时,我收到以下错误“BC36637: The '?' 此处不能使用字符。" 和分号 ';' 在 false 的末尾也给了我一个语法错误。谢谢你指导我。
<script type="text/javascript">
function AppViewModel() {
var self = this;
self.loggedIn = @(Request.IsAuthenticated ? "true" : "false");
}
$(document).ready(function () {
ko.applyBindings(new AppViewModel());
});
</script>