Export (0) Print
Expand All

WSFederationAuthenticationModule.AuthorizationFailed Event

.NET Framework 4.5

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

Namespace:  System.IdentityModel.Services
Assembly:  System.IdentityModel.Services (in System.IdentityModel.Services.dll)

public event EventHandler<AuthorizationFailedEventArgs> AuthorizationFailed

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.

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");


.NET Framework

Supported in: 4.6, 4.5

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

© 2014 Microsoft