private static HttpWebRequest BuildThirdRequest(CookieContainer cookies, HttpWebRequest httpRequest, string requestBody)
{
string POSTANON = "https://login.microsoftonline.com/login.srf";
//POST the Info and Accept the Bungie Cookies
httpRequest = (HttpWebRequest)HttpWebRequest.Create(POSTANON);
httpRequest.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.8) Gecko/20100202 Firefox/3.5.8 (.NET CLR 3.5.30729)";
httpRequest.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
httpRequest.Headers.Add("Accept-Language", "en-us,en;q=0.5");
httpRequest.Headers.Add("Accept-Encoding", "gzip,deflate");
httpRequest.Headers.Add("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7");
httpRequest.Headers.Add("Keep-Alive", "115");
httpRequest.Referer = loginUrl;
httpRequest.CookieContainer = cookies;
httpRequest.ContentType = "application/x-www-form-urlencoded";
httpRequest.Method = WebRequestMethods.Http.Post;
httpRequest.Expect = null;
using (Stream ostream = httpRequest.GetRequestStream())
{
byte[] buffer = ASCIIEncoding.ASCII.GetBytes(requestBody);
ostream.Write(buffer, 0, buffer.Length);
ostream.Close();
}
return httpRequest;
}