I need to use a view-based authorization and when i do the following, i get Server error in the application
@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>}
What may be the solution or the problem ?