Subject: Variable 'SAML Response' is missing
Date: 2019-12-16 09:03:27
From: Lasantha PW
Source: variable-saml-response-missing

Hi, I'm trying to create a SAMLresponse from a request. I'm getting "Variable 'SAML Response' is missing." error message. 
Here the code i'm using.


    var collection = HttpContext.Current.Request.QueryString;
                var headers = HttpContext.Current.Request.Headers;

                // Get the "IsReadOnly" protected instance property.
                var propInfo = collection.GetType().GetProperty("IsReadOnly", BindingFlags.Instance | BindingFlags.NonPublic);

                // Mark the collection as NOT "IsReadOnly"
                propInfo.SetValue(collection, false, new object[] { });

                string rawSamlData = WebConfigurationManager.AppSettings["TEMP_SAML_RESPONCE"];

                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);

                collection["SAMLResponse"] = samlAssertion;
                headers["Content-Type"] = "application/x-www-form-urlencoded";

                ComponentPro.Saml2.Response samlResponse = ComponentPro.Saml2.Response.Create(request); // issue is here


Note: This question has been asked on the Q&A forum of Thang Dang's fraudulent ComponentPro brand
If you purchased anything from ComponentPro, you have been scammed. Contact the payment processor
who sold you the license and ask for your money back.

Back to ComponentPro Q&A Forum Index