给定以下控制器:
public class MyController : Controller
{
[AllowAnonymous]
[ResponseCache(VaryByQueryKeys = new string[] { "id" }]
public async IActionResult Action1(string id)
{
if (User.Identity.IsAuthenticated)
return RedirectToAction("Action2", new {id = id});
return View();
}
[Authorize]
public async IActionResult Action2(string id)
{
return View();
}
}
假设经过身份验证的用户导航到“/Mycontroller/Action1/20”。响应会被缓存吗?
如果答案是肯定的,如何只缓存匿名响应?