When I used ComponentSpace SAML2 API to process the SAML message, I got the messsage expired error. The code I used to check if the message is expired or not is: if (!samlAssertion.Conditions.IsWithinTimePeriod()) { // Message expired } It seems the IsWithinTimePeriod() function uses the local time to compare with NotBefore and NotOnOrAfter attributes in the SAML message. Since SAML message uses UTC time for all the datetime related attributes, the IsWithinTimePeriod() function often returns false because of the big difference between local time and UTC time. In order to check if the message is expired or not, we cannot use the IsWithinTimePeriod() function. I used following code to check the exipiration: if (!(DateTime.Now.ToUniversalTime() > samlAssertion.Conditions.NotBefore && DateTime.Now.ToUniversalTime() < samlAssertion.Conditions.NotOnOrAfter)) { // Message expired }