SSL Communication

   

You might need to communicate over a secure connection. If you do, chances are that you will be using the Secure Socket Layer (SSL). The example in Listing 26.6 shows you how to make requests using SSL.

Listing 26.6 Requesting Data Through SSL
 try  {      WebRequest req = WebRequest.Create( "https://www.SecureServer.com" );      WebResponse result = req.GetResponse();      Stream ReceiveStream = result.GetResponseStream();       Encoding encode = System.Text.Encoding.GetEncoding( "utf-8" );      StreamReader sr = new StreamReader( ReceiveStream, encode );      Char[] ReadBuffer = new Char[256];      int nCount = sr.Read( ReadBuffer, 0, 256 );      while( nCount > 0 )      {          String str = new String( ReadBuffer, 0, nCount );          nCount = sr.Read( ReadBuffer, 0, 256 );      }  }  catch( Exception )  {      // Handle the exception here  } 
   


Special Edition Using ASP. NET
Special Edition Using ASP.Net
ISBN: 0789725606
EAN: 2147483647
Year: 2002
Pages: 233

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net