Generating SAML SP metadata from code

Hi, is there a way to generate the SAML service provider metadata from code? We would like to generate the xml on the fly so that it’s not site specific, so that our app users can enter the URL in Ping (or download it dynamically) instead of uploading XML that we manually provide to them.

Hi James
Yes, it’s certainly possible to generate SAML metadata from your code.
Please refer to the projects under Examples\Metadata. The ExportMetadata project generates SAML metadata in a console application.
The ExampleServiceProvider project under Examples\SSO\HighLevelAPI\WebForms includes a SAML/ExportMetadata.aspx page that demonstrates generating metadata in a web application.