However this code is causing an exception:
static void Main(string[] args)
{
TicketAcquirer t = new TicketAcquirer();
string s = t.GetTicket(); // ticket format t=xxx=
Test(s);
}
static void Test(string token)
{
String uri = "https://cumulus.services.live.com/my_email@hotmail.com/LiveContacts/Contacts";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
request.Method = "GET";
request.Headers.Add("Authorization", "WLID1.0 t=\"" + token + "\"");
try
{
HttpWebResponse response = (HttpWebResponse)request.GetResponse(); // error here
XmlDocument contacts = new XmlDocument();
contacts.LoadXml(new StreamReader(response.GetResponseStream()).ReadToEnd());
contacts.Save("MyContacts.xml");
response.Close();
}
catch (WebException ex)
{
Console.WriteLine(ex.Message);
}
}
What am I doing wrong?
Hisham:
If I understand your last post correctly, your problem has been solved. Let me know if you still need help.