WSFederationAuthenticationModule.AuthorizationFailed Event


Occurs when the module is determining whether it should redirect the user to the configured issuer to authenticate.

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


void WSFederationAuthenticationModule_AuthorizationFailed(object sender, AuthorizationFailedEventArgs e)
    //Use this event to report more details regarding the ahorization failure
    System.Diagnostics.Trace.WriteLine("Handling AuthorizationFailed event");



The AuthorizationFailed event is raised when authorization has failed for an HTTP request. It is raised from within the OnEndRequest event-handler delegate through a call to the OnAuthorizationFailed method.

You can set the AuthorizationFailedEventArgs.RedirectToIdentityProvider property to control whether the request is redirected to the identity provider. The framework initializes this property to false if the user has already been authenticated. In this case, setting the property to true may cause a circular loop with the STS.


The RedirectingToIdentityProvider event can be used to modify the URL or cancel the redirect.

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

Applies to