Hi all,
I am making use of a HttpWebRequest to get free/busy information for OWA. My method is working perfectly when the web request occurs over HTTP, but as soon as I change it to HTTPS I receive what looks like the content of a HTML page? :confused::confused: It's like the authentication did not occur...
I have tried what the following site suggested:
httpwebrequest-over-ssl-with-client-credentials[
^], but was left with the same result.
Here is my code:
ServicePointManager.ServerCertificateValidationCallback =
delegate(Object obj, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
{
return true;
};
HttpWebRequest httpWRequest = (HttpWebRequest)WebRequest.Create(string.Concat("https://server/public/?cmd=freebusy&start=", timeFrom.ToString("s"), "+02:00&end=", timeTo.ToString("s"), "+02:00&interval=", IntervalInMinutes.ToString(), "&u=SMTP:", entityID));
httpWRequest.Credentials = new NetworkCredential(this.txtUsername.Text, this.txtPassword.Text);
httpWRequest.KeepAlive = false;
httpWRequest.PreAuthenticate = true;
httpWRequest.Headers.Set("Pragma", "no-cache");
httpWRequest.ContentType = "text/xml";
httpWRequest.Method = "GET";
httpWRequest.Headers.Add("Translate", "t");
httpWRequest.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.1)";
HttpWebResponse httpWResponse = (HttpWebResponse)httpWRequest.GetResponse();
Stream strm = httpWResponse.GetResponseStream();
StreamReader sr = new StreamReader(strm);
string text = sr.ReadToEnd();
this.rTxtOutput.Text = string.Format("Http Web Response: {0}\n\n", text);
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(text);
XmlNamespaceManager nsmngr = new XmlNamespaceManager(xmlDoc.NameTable);
nsmngr.AddNamespace("a", "WM");
XmlNode nodeFreeBusy = xmlDoc.SelectSingleNode("a:response/a:recipients/a:item[2]/a:fbdata", nsmngr);
if (nodeFreeBusy.InnerText != string.Empty)
{
sAvailability = nodeFreeBusy.InnerText;
}
Any pointers??
Many thanks in advance.
Kind regards,