Download presentation
Presentation is loading. Please wait.
Published byLyndsey Brisby Modified over 10 years ago
15
HttpWebRequest r = WebRequest.Create(url) as HttpWebRequest; r.Headers.Add("Authorization", "Bearer" + " " + accessToken); using (HttpWebResponse resp = r.GetResponse() as HttpWebResponse) { Encoding e = System.Text.Encoding.GetEncoding("utf-8"); StreamReader s = new StreamReader(resp.GetResponseStream(), e); string json = s.ReadToEnd();
16
SetCookies(); //get the session and yamtrack cookie HttpWebRequest r = WebRequest.Create(url) as HttpWebRequest; r.Headers.Add("Authorization", "Bearer" + " " + accessToken); r.Method = "POST"; r.CookieContainer = cookieContainer; //set the post data and content type byte[] postByte = Encoding.UTF8.GetBytes(postData); r.ContentLength = postByte.Length; r.ContentType = String.IsNullOrEmpty(contentType) ? "application/x-www-form-urlencoded" : contentType; //write the stream and get response Stream postStream = r.GetRequestStream(); postStream.Write(postByte, 0, postByte.Length); postStream.Close(); using (HttpWebResponse resp = r.GetResponse() as HttpWebResponse) { postStream = resp.GetResponseStream(); StreamReader postReader = new StreamReader(postStream); var json = postReader.ReadToEnd();
32
#WorkLikeANetwork
34
www.microsoft.com/learning http://microsoft.com/msdn http://microsoft.com/technet http://channel9.msdn.com/Events/TechEd
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.