예제 #1
0
 public Form1()
 {
     InitializeComponent();
     clsXMLSettings xml      = new clsXMLSettings();
     xmlSettings    settings = xml.ReadSettings();
     clsWeb         web      = new clsWeb(settings);
 }
        public static void sendDataToSite()
        {
            clsWeb web = new clsWeb();

            url = "http://milestoneit.net/api/appinit/" + clsWeb.code;
            // Create a request using a URL that can receive a post.
            HttpWebRequest webreq = (HttpWebRequest)WebRequest.Create(url);

            webreq.Method      = "GET";
            webreq.ContentType = "Text";
            HttpWebResponse webresp = (HttpWebResponse)webreq.GetResponse();
            // Get the stream associated with the response.
            Stream receiveStream = webresp.GetResponseStream();
            // Pipes the stream to a higher level stream reader with the required encoding format.
            StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8);
            var          encoding   = ASCIIEncoding.ASCII;

            using (var reader = new System.IO.StreamReader(webresp.GetResponseStream(), encoding))
            {
                responseFromServer = reader.ReadToEnd();
            }
            web.Decode();
            webresp.Close();
        }