Manually parse a SAML (SSO) token

How to manually parse a SAML (Security Assertion Markup Language) token.
SAML - is an XML-based, open-standard data format for exchanging authentication and authorization data between parties, in particular, between an identity provider and a service provider.
To get the SAML token request and decode it I do the following:
// Get the querystring "SAMLResponse" 
string rawSamlData = Request["SAMLResponse"];

// Check if the data sent is already encoded, if not results in double encoding
if (rawSamlData.Contains('%'))
{
    rawSamlData = HttpUtility.UrlDecode(rawSamlData);
}

// read the base64 encoded bytes
byte[] samlData = Convert.FromBase64String(rawSamlData);

// read back into a UTF string
string samlAssertion = Encoding.UTF8.GetString(samlData);
Happy Coding :)