Post Data Issue

19 views
Skip to first unread message

Brian Fout

unread,
Jun 3, 2024, 11:50:05 AMJun 3
to Adobe LiveCycle Developers
I am trying to send form data to aem in the body of a http post.  This appears to work as long as the data does not include "%" or "&".  The form is coming back blank.  I assume aem is throwing some sort of exception, but I'm not sure where to look to see what the exception says.

Could someone tell me where to look for the exception.

                var webRequest = WebRequest.Create(aemLink);
                webRequest.Method = "POST";
                webRequest.ContentType = "application/x-www-form-urlencoded";

                //byte[] dataBytes = Encoding.ASCII.GetBytes($"data={formXMLData}");
                byte[] dataBytes = Encoding.UTF8.GetBytes($"data={formXMLData}");

                webRequest.ContentLength = dataBytes.Length;
                //WebRequest required data streaming for the body of the request
                using (var stream = webRequest.GetRequestStream())
                {
                    stream.Write(dataBytes, 0, dataBytes.Length);
                }
                //AEM Website call
                var responseStream = webRequest.GetResponse().GetResponseStream();
                string result = "";
                //Streaming the AEM response
                using (var sr = new StreamReader(responseStream, Encoding.UTF8))
                {
                    result = sr.ReadToEnd();
                }

                var updatedHtml = UpdateAemLocalLinksHtml(result);
                Response.Write(updatedHtml);

fred.pantalone

unread,
Jun 4, 2024, 5:07:17 PMJun 4
to Adobe LiveCycle Developers
what version of AEM and what server and environment is it running on?
Reply all
Reply to author
Forward
0 new messages