我试图在Application_Start()中订阅RedirectingToIdentityProvider事件,但是FederatedAuthentication.WSFederationAuthenticationModule为null
码
protected void Application_Start() { FederatedAuthentication.WSFederationAuthenticationModule.RedirectingToIdentityProvider += WSFederationAuthenticationModule_RedirectingToIdentityProvider; }
解决方法
尝试这样做 – 适合我.
void Application_Start() { FederatedAuthentication.ServiceConfigurationCreated += OnServiceConfigurationCreated; } void OnServiceConfigurationCreated(object sender,ServiceConfigurationCreatedEventArgs e) { FederatedAuthentication.WSFederationAuthenticationModule.RedirectingToIdentityProvider += WSFederationAuthenticationModule_RedirectingToIdentityProvider; }