SSL Communication

You may need to communicate over a secure connection. If you do, chances are that you will be using the Secure Sockets Layer (SSL). The example in Listing 13.6 shows you how to make requests using SSL because the user is simply using HTTPS.

Listing 13.6 Requesting Data via 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 } 


ASP. NET Solutions - 24 Case Studies. Best Practices for Developers
ASP. NET Solutions - 24 Case Studies. Best Practices for Developers
ISBN: 321159659
EAN: N/A
Year: 2003
Pages: 175

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