【发布时间】:2019-01-20 09:31:12
【问题描述】:
我需要使用基于视图的授权,当我执行以下操作时,应用程序中出现服务器错误
@if (User.Identity.IsAuthenticated)
{
if (User.IsInRole("Admin"))
{
<h4>Create a new document</h4>
@using(Html.BeginForm("Create", "Document", null, FormMethod.Post, new { enctype = "multipart/form-data" }))
{
@Html.AntiForgeryToken()
<span>SOME HTML COD</span>
}
}
else
{ <span>Vous devez être administrateur pour accéder à cette section</span>}
}
else
{<span>Vous devez être connecté pour accéder à cette section</span>}
解决方案或问题可能是什么?
【问题讨论】:
标签: asp.net asp.net-mvc razor