How can I check StatusCode Value in SAML Response?

I’m receiving the xml below and I need to check if StatusCode Value inside Status is Success, because after SAMLServiceProvider.ReceiveSLO() the isRequest variable is false while the request is success.

<?xml version="1.0"?>
<samlp:LogoutResponse xmlns:samlp=“urn:oasis:names:tc:SAML:2.0:protocol” Version=“2.0” ID=“nVALv5WV8K_Xs-wz97_tEqu-xiC” IssueInstant=“2018-05-16T05:47:18.198Z” InResponseTo=“_84ee22fc-8c8f-400b-83f6-7607e794087e” Destination=“”>http://localhost:49804/SAMLSP/SLOService">
<saml:Issuer xmlns:saml=“urn:oasis:names:tc:SAML:2.0:assertion”>SAMLProvider</saml:Issuer>
<ds:Signature xmlns:ds=“”>http://www.w3.org/2000/09/xmldsig#“>
ds:SignedInfo
<ds:CanonicalizationMethod Algorithm=”“>http://www.w3.org/2001/10/xml-exc-c14n#”/>
<ds:SignatureMethod Algorithm=“”>http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/>
<ds:Reference URI=“#nVALv5WV8K_Xs-wz97_tEqu-xiC”>
ds:Transforms
<ds:Transform Algorithm=“”>http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
<ds:Transform Algorithm=“”>http://www.w3.org/2001/10/xml-exc-c14n#“/>
</ds:Transforms>
<ds:DigestMethod Algorithm=”“>http://www.w3.org/2001/04/xmlenc#sha256”/>
ds:DigestValueQnRRNEqWh2H99dn8Y/Srvc8puLS4LY0vo9f/LQgIeGA=</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
ds:SignatureValue</ds:SignatureValue>
ds:KeyInfo
ds:X509Data
ds:X509Certificate
</ds:X509Certificate>
</ds:X509Data>
</ds:KeyInfo>
</ds:Signature>
samlp:Status
<samlp:StatusCode Value=“urn:oasis:names:tc:SAML:2.0:status:Success”/>
</samlp:Status>
</samlp:LogoutResponse>

The isRequest argument indicates whether a SAML logout request or response is received.
If isRequest is true, a request was received, otherwise a response was received.
We log any logout response error status but don’t throw an exception up to the application.

[quote]
ComponentSpace - 5/15/2018
The isRequest argument indicates whether a SAML logout request or response is received.
If isRequest is true, a request was received, otherwise a response was received.
We log any logout response error status but don't throw an exception up to the application.

[/quote]

so if isRequest is false I know its a response, Thanks for that.
but is There any way to check StatusCode Value in the response??

You could subscribe to SAML notifications and access the logout response directly to check the status.
This requires you to implement the ComponentSpace.SAML2.Notifications.ISAMLObserver interface.
There’s an OnLogoutResponseReceived event which makes available the LogoutResponse.


using ComponentSpace.SAML2.Notifications;
using ComponentSpace.SAML2.Protocols;

public class SAMLObserver : AbstractSAMLObserver
{
public override void OnLogoutResponseReceivedstring partnerName, LogoutResponse logoutResponse)
{
// Check the logout response status – details not shown.
if (!logoutResponse.IsSuccess())
{
}
}
}

// Subscribe to events, for example, at application start-up in Global.asax.

protected void Application_Start()
{
SAMLObservable.Subscribe(new SAMLObserver());
}


[quote]
ComponentSpace - 5/16/2018
You could subscribe to SAML notifications and access the logout response directly to check the status.
This requires you to implement the ComponentSpace.SAML2.Notifications.ISAMLObserver interface.
There's an OnLogoutResponseReceived event which makes available the LogoutResponse.


using ComponentSpace.SAML2.Notifications;
using ComponentSpace.SAML2.Protocols;

public class SAMLObserver : AbstractSAMLObserver
{
public override void OnLogoutResponseReceivedstring partnerName, LogoutResponse logoutResponse)
{
// Check the logout response status – details not shown.
if (!logoutResponse.IsSuccess())
{
}
}
}

// Subscribe to events, for example, at application start-up in Global.asax.

protected void Application_Start()
{
SAMLObservable.Subscribe(new SAMLObserver());
}


[/quote]

Thanks I will give it a try

You’re welcome.