且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ASP.NET MVC。检查用户从授权的JavaScript

更新时间:2023-12-01 15:35:16

我喜欢@盖比的评论的想法,虽然我不知道这是否是可行的,因为我没有对你的项目的全貌。

I like the idea in @Gaby's comment, though I am not sure whether that's doable since I don't have the whole picture on your project.

最起码你可以通过执行简化您的code ...

At the very least you can simplify your code by doing...

<script>
  var userAuthorized = @User.Identity.IsAuthenticated.ToString().ToLower();
</script>