Adding custom XML header to your SAML response

Custom SAML XML header
Some vendors require having XML header-like added to a SAML response before sending. With the Ultimate SAML for .NET, you can accomplish that by using the method SendPostBindingForm(Stream output, string messageFormVariableName, string targetUrl, string relayState, string xmlHeader). The xmlHeader method parameter specifies the custom XML header added to the SAML message. For example, it can be "<?xml version="1.0" encoding="utf-8"?>".

The following code snippet shows you how to use that method:

SendPostBindingForm(Response.OutputStream, "SAMLResponse", "http://comsumer-service-url/consumer.aspx", "my relay state", "<?xml version=\"1.0\" encoding=\"utf-8\"?>")

For more information on how to create a SAML response, take a look at this example:

// Create SAML Response object. 
Response response = new Response();    

Assertion samlAssertion = new Assertion();
Audience aud = new Audience();
aud.Uri = "";
AudienceRestriction ar = new AudienceRestriction();

samlAssertion.Conditions = new Conditions();

// Sign the assertion. 

// Add SAML Assertion 

After the response is created you can use the SendHttpPost method to send it.

45-Day Money Back Guarantee

We will refund your full money in 45 days
if you are not satisfied with our products

Buy Now

Dont miss out Get update on new articles and other opportunities