Example #1
0
 static void Main(String[] args)
 {
     try
     {
         HttpConnect myHttpConnect = new HttpConnect();
         // If the Uri is valid  then 'ConnectHttpServer' method will connect to the server.
         myHttpConnect.ConnectHttpServer("www.contoso.com");
     }
     catch (WebException e)
     {
         Console.WriteLine("\nThe New Message is:" + e.Message);
     }
 }
Example #2
0
 static void Main()
 {
     try
     {
         Console.WriteLine("Please give any Intranet Site Address (eg:manjeera.wipro.com)");
         String      uriConnect    = Console.ReadLine();
         HttpConnect myHttpConnect = new HttpConnect();
         myHttpConnect.ConnectHttpServer(uriConnect);
     }
     catch (WebException e)
     {
         Console.WriteLine("\nThe  WebException is :" + e.Message);
         Console.WriteLine("\nThe status of the WebException is :" + e.Status);
         Console.WriteLine("\nThe Inner Exception is :'" + e.InnerException + "'");
         Console.WriteLine("\nThe Web Response is:\n");
         StreamReader readStream = new StreamReader(e.Response.GetResponseStream());
         Console.WriteLine(readStream.ReadToEnd());
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }