public bool Send(Exception ex, List<KeyValuePair<string, string>> customParams = null)
{
XmlDocument xml = this.GetXML(ex, customParams);
// Create a request using a URL that can receive a post.
string url;
if (this.SSL)
{
url = "https://" + this.Host + this.Path;
}
else
{
url = "http://" + this.Host + this.Path;
}
WebRequest request = WebRequest.Create(url);
// Set our POST data
request.Method = "POST";
// Encode our post data
byte[] byteArray = Encoding.UTF8.GetBytes(xml.OuterXml);
request.ContentType = "text/xml";
request.ContentLength = byteArray.Length;
// Get the request stream (open for writing)
Stream dataStream = request.GetRequestStream();
dataStream.Write(byteArray, 0, byteArray.Length);
dataStream.Close();
// Get the response.
WebResponse response = null;
HttpWebResponse r = null;
try
{
response = request.GetResponse();
r = (HttpWebResponse)response;
}
catch
{
return false;
}
// Make sure we got a 200
if (r.StatusCode != HttpStatusCode.OK)
{
return false;
}
// Clean up the streams.
dataStream.Close();
response.Close();
return true;
}