public class BaseController : Controller
{
// GET: Base
public static UserManager.User _CurrentUser;
}
}
This code is part of my BaseController and I want to use _CurrrentUser.Id as key for outputcache.
[OutputCache(Duration = 1200, VaryByCustom = _CurrentUser.Id)]
When I tried to do this, it say "Argument in attribute must be constant exprssion" and it's also need to set to static.
I can make this property static but how I can make it constant expression so I can use it for outputcache.
I recommend you should get CurrentUserId from Auth. Cookie. I use like that.
Cookie Helper Method like that