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