Export (0) Print
Expand All

WSFederationAuthenticationModule::AuthorizationFailed Event

.NET Framework 4.6 and 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)

 event EventHandler<AuthorizationFailedEventArgs^>^ AuthorizationFailed {
	void add (EventHandler<AuthorizationFailedEventArgs^>^ value);
	void remove (EventHandler<AuthorizationFailedEventArgs^>^ value);

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
© 2015 Microsoft