WSFederationAuthenticationModule.RedirectingToIdentityProvider 事件

定義

當模組要將使用者重新導向到識別提供者時發生。

public:
 event EventHandler<System::IdentityModel::Services::RedirectingToIdentityProviderEventArgs ^> ^ RedirectingToIdentityProvider;
public event EventHandler<System.IdentityModel.Services.RedirectingToIdentityProviderEventArgs> RedirectingToIdentityProvider;
member this.RedirectingToIdentityProvider : EventHandler<System.IdentityModel.Services.RedirectingToIdentityProviderEventArgs> 
Public Custom Event RedirectingToIdentityProvider As EventHandler(Of RedirectingToIdentityProviderEventArgs) 
Public Event RedirectingToIdentityProvider As EventHandler(Of RedirectingToIdentityProviderEventArgs) 

事件類型

範例

下列程式碼示範如何在 global.asax 檔案的 事件中 Application_Init 新增 事件的處理常式 RedirectingToIdentityProvider 。 程式碼取自 FederationForWebApps 範例。 如需此範例的詳細資訊,請參閱 WIF 程式碼範例索引

下列程式碼顯示 RP 之 global.asax 檔案中事件的處理常式 RedirectingToIdentityProvider 。 程式碼會檢查傳入的 HTTP 要求是否包含 whr 參數,如果是的話,它會在傳送至 STS 的WS-Federation登入要求上設定此參數。 程式碼取自 FederationForWebApps 範例。 如需此範例的詳細資訊,請參閱 WIF 程式碼範例索引

下列程式碼顯示同盟提供者 STS 之 global.asax 檔案中事件的處理常式 RedirectingToIdentityProvider 。 程式碼會檢查傳入 HTTP 要求是否包含 whr 參數。 如果要求包含 whr 參數,用戶端會導向 IP-STS 進行登入;如果沒有,用戶端會導向至主領域探索頁面,以選取要登入的 IP-STS。 程式碼取自 FederationForWebApps 範例。 如需此範例的詳細資訊,請參閱 WIF 程式碼範例索引

備註

您可以透過 RedirectingToIdentityProviderEventArgs.SignInRequestMessage 屬性存取和修改WS-Federation登入要求。 例如,您可以修改 BaseUri 登入訊息中的 屬性,以變更要求將重新導向的識別提供者。 事件 RedirectingToIdentityProvider 是可取消的事件,您可以將 屬性設定 Canceltrue 以取消重新導向。

事件會透過呼叫 OnRedirectingToIdentityProvider 方法,從 方法內部 RedirectToIdentityProvider 引發。

若要在 ASP.NET 應用程式中處理此事件,請在 global.asax 檔案中建立名為 WSFederationAuthentication_RedirectingToIdentityProvider 的方法。

適用於