Can someone explain this block of ASP.NET MVC code to me, please?

前端 未结 2 1932
傲寒
傲寒 2021-01-01 02:52

this is the current code in ASP.NET MVC2 (RTM) System.Web.Mvc.AuthorizeAttribute class :-

public virtual void OnAuthorization(AuthorizationConte         


        
2条回答
  •  梦谈多话
    2021-01-01 03:26

    call to AuthorizeCore will validate if request is authorized. If authorized, it put an AddValidationCallback in order to test if the cached output is still valid according to cache policy. If so, the cached output is sent to the client.

    Regarding the 3 lines for caching; well, first at all you should understand that an output cache must be correct or as correct as possible. In order to meassure its "correctness", the system will test if it meets certain conditions (e.g. it has not been modified). This is stuff can be done in the 3 lines..

提交回复
热议问题