WSFederationAuthenticationModule.RedirectingToIdentityProvider Event

Definition

Occurs when the module is going to redirect the user to the identity provider.

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) 

Event Type

Examples

The following code shows how to add a handler for the RedirectingToIdentityProvider event in the Application_Init event in the global.asax file. The code is taken from the FederationForWebApps sample. For more information about this sample, see WIF Code Sample Index.

The following code shows the handler for the RedirectingToIdentityProvider event in the global.asax file of an RP. The code checks to see whether the incoming HTTP request contains a whr parameter, and, if it does, it sets this parameter on the WS-Federation sign-in request that will be sent to the STS. The code is taken from the FederationForWebApps sample. For more information about this sample, see WIF Code Sample Index.

The following code shows the handler for the RedirectingToIdentityProvider event in the global.asax file of a federation provider STS. The code checks to see whether the incoming HTTP request contains a whr parameter. If the request contains the whr parameter, the client is directed to the IP-STS for sign-in; if not, the client is directed to a home realm discovery page to select the IP-STS at which to sign in. The code is taken from the FederationForWebApps sample. For more information about this sample, see WIF Code Sample Index.

Remarks

You can access and modify the WS-Federation sign-in request through the RedirectingToIdentityProviderEventArgs.SignInRequestMessage property. For example, you can modify the BaseUri property in the sign-in message to change the identity provider to which the request will be redirected. The RedirectingToIdentityProvider event is a cancelable event and you can set the Cancel property to true to cancel the redirect.

The event is raised from inside the RedirectToIdentityProvider method through a call to the OnRedirectingToIdentityProvider method.

To handle this event in an ASP.NET application, create a method called WSFederationAuthentication_RedirectingToIdentityProvider in the global.asax file.

Applies to