2014-08-28 47 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