This should EVEN work in web forms, but don't expect it to work with POST, PUT, or DELETE.
string url = @"http://www.example.com/api/whatever?foo=bar";
WebRequest webRequest = WebRequest.Create(url);
HttpWebResponse httpWebResponse = (HttpWebResponse)request.GetResponse();
Stream dataStream = httpWebResponse.GetResponseStream();
StreamReader streamReader = new StreamReader(dataStream);
string responseFromServer = streamReader.ReadToEnd();
No comments:
Post a Comment