我是asp.net Identity的新手,我似乎无法弄清楚如何只允许登录用户访问我的控制器中的某些页面。我正在阅读的所有文档似乎都过时了。基本上我想在用户向服务器发出请求时将用户转发到登录页面,该服务器运行一个指定的控制器函数,如此
//How do I prevent anonymous user from preforming this model action
//Unless they are logged in
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> SomeModelAction([Bind("ID,AModelField,UserID")] AModel aModel)
{
//code to preform action on a model
return View(aModel);
}