2014-08-28 49 views

回答

1

您可以处理AuthenticateRequest事件传递给Init方法您IHttpModule执行HttpApplication的:

// IHttpModule.Init 
public void Init(HttpApplication context) 
{ 
    // subscribe to the AuthenticateRequest event 
    context.AuthenticateRequest += this.onApplicationAuthenticateRequest; 
} 

private void onApplicationAuthenticateRequest(object sender, EventArgs e) 
{ 
    // your code goes here 
} 

This article在网页API,使用自定义的HttpModule的基本身份验证的一个例子,可能是很有帮助。

+0

啊 - 文档没有解释'Authenticate'事件是在'AuthenticateRequest'事件期间引发的,但是我忽略了 - 谢谢。 – Justin 2014-08-28 12:03:01