Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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,
Posted
Updated 8-Apr-10 21:09pm
v2

1 solution

ANSWER:

access-to-owa-programmatically[^]

Kind regards,
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900