Ejemplo n.º 1
0
 /// <summary>
 /// Here we actually make the request to the web server and
 /// retrieve it's response into a text buffer.
 /// </summary>
 public virtual void GetResponse()
 {
     if (null == coFileStream)
     {
         Stream      stream;
         WebResponse response;
         try
         {
             response = coRequest.GetResponse();
         }
         catch (WebException web)
         {
             response = web.Response;
         }
         if (null != response)
         {
             stream = response.GetResponseStream();
             StreamReader sr = new StreamReader(stream);
             string       str;
             ResponseText.Length = 0;
             while ((str = sr.ReadLine()) != null)
             {
                 ResponseText.Append(str);
             }
             response.Close();
         }
         else
         {
             throw new Exception("MultipartForm: Error retrieving server response");
         }
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Here we actually make the request to the web server and
 /// retrieve it's response into a text buffer.
 /// </summary>
 public virtual void getResponse()
 {
     if (null == coFileStream)
     {
         System.IO.Stream io;
         WebResponse      oResponse;
         try
         {
             oResponse = coRequest.GetResponse();
         }
         catch (WebException web)
         {
             System.Windows.Forms.MessageBox.Show("Caught web exception: " + web.ToString());
             oResponse = web.Response;
         }
         if (null != oResponse)
         {
             io = oResponse.GetResponseStream();
             StreamReader sr = new StreamReader(io);
             string       str;
             ResponseText.Length = 0;
             while ((str = sr.ReadLine()) != null)
             {
                 ResponseText.Append(str);
             }
             oResponse.Close();
         }
         else
         {
             throw new Exception("MultipartForm: Error retrieving server response");
         }
     }
 }