Search code examples
saml-2.0sustainsys-saml2

Change Sustainsys.Saml2 HttpModule Configuration Programmatically


I have a legacy Web Forms ASP.Net project where I just successfully integrated Sustainsys.Saml2.

I was wondering how can Make configuration changes programmatically.

For example: in the webconfig, I define my (the SP) metadata url. However, because I run on my Dev machine, plus a test server, a QA server and then production server, each have their own Urls. I want to be able to programmatically change the Url based on the site that is running.

Thank you.


Solution

  • Yes, it's possible. You can access the Options.FromConfiguration static property and modify it from code. In fact, many of the recent added features are not available in web.config.

    The Options.FromConfiguration will read settings from web.config on first access, but then the copy in memory is free to modify.