How to Enable multiple Identity providers in Saml.config with different Key names in web.config file

I have created two different keys for two different identity providers in web.config.
In Saml.config, enabled two different Identityprovider configuration and two different service provider configuration. when i enable both configurations, Iam getting below error.

A schema validation error occurred in at line 0, column 0. Element ‘urn:componentspace:SAML:2.0:configuration:ServiceProvider’ cannot appear more than once if content model type is “all”
Exception: ComponentSpace.SAML2.Exceptions.SAMLSchemaValidationException: One or more configuration XML schema validation errors occurred.
at ComponentSpace.SAML2.Exceptions.SAMLSchemaValidationException…ctor(String message, IList warnings, IList errors)
at ComponentSpace.SAML2.Configuration.SchemaValidator.ValidateConfiguration(XmlDocument xmlDocument)
at ComponentSpace.SAML2.Configuration.SAMLConfigurationFile.Load(String fileName)
at ComponentSpace.SAML2.SAMLController.Initialize()
at ComponentSpace.SAML2.InternalSAMLServiceProvider…ctor()


If I comment one Identity provider configuration, it is working fine. Iam using ADFS and OKTA as IDP, I need to switch between two Idp’s based on setting in database with out changing code.
please help me out.

Just to confirm, your application is the SP and you wish to support multiple partner IdPs.
Assuming so, the outline of your saml.config is as follows.














Please refer to the ExampleServiceProvider’s saml.config which includes entries for ADFS, Okta and other partner IdPs.