MVC3 Global执行顺序

IV:附录:Global执行顺序

当WebApp开始运行时

Application_Start

Application_BeginRequest

Application_AuthenticateRequest

Session_Start

当WebApp终止运行时

Session_End

Application_End

当一个Request入站时

Application_BeginRequest

Application_AuthenticateRequest 过后到达*.cshtml

当在*.cshtml throw new Exception();时

Application_BeginRequest

Application_AuthenticateRequest

Application_Error(在throw处转至,不会执行*.cshtml的throw后的下文)
例:
@{
Throw new Exception();//仅做示例
//下文不会被执行,而直接跳到Application_Error终止Response
}

你可能感兴趣的:(global)