Tag: httpapplication

AuthenticateRequest事件

Q 1.我的理解FormsAuthenticationModule订阅了AuthenticateRequest事件,因此只有在这个事件被触发之后, FormsAuthenticationModule才会被调用。 但是下面的引用让我有些困惑: AuthenticateRequest事件表示configuration的authentication机制已经authentication了当前的请求。 上面的引用不是说当AuthenticateRequest事件发生时,请求(又名用户)已经被authentication了吗? 订阅AuthenticateRequest事件可确保在处理附加的模块或事件处理程序之前对请求进行身份validation。 据我了解这个引用,如果我们订阅AuthenticatedRequest ,那么我们的事件处理程序将在FormsAuthenticationModule之前被调用? 因此Application_AuthenticateRequest()将在FormsAuthenticationModule被调用之前调用? 问2.我从中学习的书,build议在Application_AuthenticateRequest()我们能够validation用户是否是特定angular色的成员,如果没有,我们可以自动添加用户: protected void Application_AuthenticateRequest(Object sender, EventArgs e) { if (User.Identity.IsAuthenticated && Roles.Enabled) { //here we can subscribe user to a role via Roles.AddUserToRole() } } 从上面的代码判断,在调用FormsAuthenticationModule之后调用Application_AuthenticateRequest() ,但是在别的地方,同一本书意味着在FormsAuthenticationModule之前调用Application_AuthenticateRequest() : Application_AuthenticateRequest在执行authentication之前被调用。 这是创build您自己的身份validation逻辑的起点。 我错过了什么? 感谢名单

HTTPModule事件执行顺序?

有没有人知道一个网站或页面,或知道HTTPApplication类的HTTPModule事件执行事件的执行顺序? 我发现所有事件的MSDN文档 ,但没有显示过程步骤的列表,我一直没能find一个。