Friday, September 2, 2016

making HTTP/HTTPS request in C#


private static string LoadUrl(string path)
            Uri myUri = new Uri(path, UriKind.Absolute);
            string stringResponse = null;
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(myUri);
            request.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv: Gecko/2008120122 Firefox/3.0.5";

            WebResponse response = request.GetResponse();
            using (Stream responseStream = response.GetResponseStream())
                StreamReader reader = new StreamReader(responseStream, Encoding.UTF8);
                stringResponse = reader.ReadToEnd();

            return stringResponse;

1 comment:

uqzh4esgfp said...

Each house contained in the neighborhood can then be purchased at a extra affordable value. You can also create mini topographies in your 3D printer, after which flip them into cute objects for house or office! Worth exploring, this is one Portable Washers of the|is amongst the|is probably certainly one of the} most attention-grabbing 3D printer designs. While it won’t be holding up a automotive in a garage any time quickly, this platform jack can still withstand a fairly cheap quantity of weight, allowing you entry to pesky undersides. 3D print your own platform jack at house for a straightforward tool that’s nice for painting models and other hobbyist tasks.