我想允许匿名访问单个路由:
public class GestionPantallaController : Controller
{
private GestionPantallaRepository repo = new GestionPantallaRepository();
// GET: GestionPantalla
public ActionResult Index()
{
var estado = repo.ObtenerEstado();
return View(estado);
}
[AllowAnonymous]
public ActionResult Estado()
{
var estado = repo.ObtenerEstado();
return Content(JsonConvert.SerializeObject(estado), "application/json");
}
}
[AllowAnonymous]无效,我也尝试在web.config中添加
<location path="GestionPantalla/Estado">
<system.web>
<authorization>
<allow users="?"/>
</authorization>
</system.web>
</location>
但我收到错误&#34;位置元素未使用:在GestionPantalla \ Estado&#34;
找不到项目项目我使用Active Directory进行身份验证