Exploring the System.Net Namespace in the .NET Framework 2.0 Glen Gordon MSDN Developer Community Champion Microsoft http:...
Agenda <ul><li>Network Status and Connectivity </li></ul><ul><li>Protocols </li></ul><ul><ul><li>SMTP </li></ul></ul><ul><...
Network Status and Connectivity <ul><li>Obtain network configuration and availability </li></ul><ul><li>Listen for changes...
Network Information <ul><li>System.Net.NetworkInformation  namespace </li></ul><ul><li>Enumerate network interfaces (adapt...
Detecting Changes <ul><li>NetworkChange class </li></ul><ul><ul><li>NetworkAddressChanged  event </li></ul></ul><ul><ul><l...
Demonstration One Network Status
Ping <ul><li>System.Net.NetworkInformation  namespace </li></ul><ul><li>Synchronous or asynchronous </li></ul><ul><li>Ping...
Demonstration Two Using Ping
Mail <ul><li>System.Net.Mail  namespace </li></ul><ul><li>SmtpClient  class </li></ul><ul><ul><li>Server, credentials, por...
Demonstration Three Sending Mail
FTP <ul><li>FtpWebRequest/FtpWebResponse </li></ul><ul><ul><li>Derived from  WebRequest/WebResponse </li></ul></ul><ul><li...
Demonstration Four FTP
Security <ul><li>Managed wrapper for Security Support Provider Interface (SSPI) </li></ul><ul><li>Abstract class  Authenti...
NegotiateStream <ul><li>Kerberos and Windows NT ®  Challenge/Response (NTLM) support </li></ul><ul><li>Send client credent...
SslStream <ul><li>X.509 certificates </li></ul><ul><li>Client can check for server certificate revocation </li></ul><ul><l...
Demonstration Five Secure Communications
HTTP Listener <ul><li>Process HTTP requests without Internet Information Services (IIS)  </li></ul><ul><li>Managed API for...
Demonstration Six HTTP Listener
Session Summary <ul><li>Your SmartClient app can be smart about network availability and configuration </li></ul><ul><li>M...
Additional Resources <ul><li>All about System.Net.Mail </li></ul><ul><ul><li>http://www.systemnetmail.com </li></ul></ul><...
 
Upcoming SlideShare
Loading in …5
×

Exploring the System.Net namespace

3,833 views

Published on

Exploring the System.Net namespace

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,833
On SlideShare
0
From Embeds
0
Number of Embeds
21
Actions
Shares
0
Downloads
0
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Exploring the System.Net namespace

  1. 1. Exploring the System.Net Namespace in the .NET Framework 2.0 Glen Gordon MSDN Developer Community Champion Microsoft http://blogs.msdn.com/glengordon
  2. 2. Agenda <ul><li>Network Status and Connectivity </li></ul><ul><li>Protocols </li></ul><ul><ul><li>SMTP </li></ul></ul><ul><ul><li>FTP </li></ul></ul><ul><li>Security </li></ul><ul><li>HTTP Listener </li></ul>
  3. 3. Network Status and Connectivity <ul><li>Obtain network configuration and availability </li></ul><ul><li>Listen for changes in network status </li></ul>
  4. 4. Network Information <ul><li>System.Net.NetworkInformation namespace </li></ul><ul><li>Enumerate network interfaces (adapters) </li></ul><ul><li>Connection information </li></ul><ul><ul><li>IP Address(es) </li></ul></ul><ul><ul><li>IPv4 vs IPv6 </li></ul></ul><ul><ul><li>DHCP </li></ul></ul><ul><ul><li>Type (Ethernet, PPP, wireless, loopback, etc.) </li></ul></ul>
  5. 5. Detecting Changes <ul><li>NetworkChange class </li></ul><ul><ul><li>NetworkAddressChanged event </li></ul></ul><ul><ul><li>NetworkAvailabilityChanged event </li></ul></ul><ul><li>Shortcut in My namespace </li></ul><ul><ul><li>My.Computer.Network.IsAvailable property </li></ul></ul><ul><ul><li>My.Computer.Network.NetworkAvailabilityChanged Event </li></ul></ul>
  6. 6. Demonstration One Network Status
  7. 7. Ping <ul><li>System.Net.NetworkInformation namespace </li></ul><ul><li>Synchronous or asynchronous </li></ul><ul><li>PingReply class </li></ul><ul><li>Shortcut in My namespace </li></ul><ul><ul><li>My.Computer.Network.Ping </li></ul></ul>
  8. 8. Demonstration Two Using Ping
  9. 9. Mail <ul><li>System.Net.Mail namespace </li></ul><ul><li>SmtpClient class </li></ul><ul><ul><li>Server, credentials, port, etc. </li></ul></ul><ul><li>MailMessage class </li></ul><ul><ul><li>Address (from, to, bcc, etc.) </li></ul></ul><ul><ul><li>Contents (subject, body, alternate views) </li></ul></ul><ul><ul><li>Attachments </li></ul></ul><ul><li>Exceptions and status </li></ul>
  10. 10. Demonstration Three Sending Mail
  11. 11. FTP <ul><li>FtpWebRequest/FtpWebResponse </li></ul><ul><ul><li>Derived from WebRequest/WebResponse </li></ul></ul><ul><li>SSL support for more secure credentials </li></ul><ul><li>Remote commands </li></ul><ul><li>Shortcut in My namespace </li></ul><ul><ul><li>My.Computer.Network.DownloadFile </li></ul></ul><ul><ul><li>My.Computer.Network.UploadFile </li></ul></ul>
  12. 12. Demonstration Four FTP
  13. 13. Security <ul><li>Managed wrapper for Security Support Provider Interface (SSPI) </li></ul><ul><li>Abstract class AuthenticatedStream </li></ul><ul><ul><li>Server and/or client authentication </li></ul></ul><ul><ul><li>Encryption and signing </li></ul></ul><ul><li>Can be used just like NetworkStream </li></ul><ul><ul><li>Synchronous or asynchronous </li></ul></ul>
  14. 14. NegotiateStream <ul><li>Kerberos and Windows NT ® Challenge/Response (NTLM) support </li></ul><ul><li>Send client credentials for impersonation or delegation </li></ul><ul><ul><li>Credentials can be cast as Principal </li></ul></ul><ul><li>Request server authentication </li></ul><ul><li>Encrypt and/or sign data </li></ul><ul><ul><li>Check for signing and encrypting </li></ul></ul>
  15. 15. SslStream <ul><li>X.509 certificates </li></ul><ul><li>Client can check for server certificate revocation </li></ul><ul><li>Provide client certificate for mutual authentication </li></ul><ul><li>Exposes cryptographic settings for authentication, encryption and data signing </li></ul>
  16. 16. Demonstration Five Secure Communications
  17. 17. HTTP Listener <ul><li>Process HTTP requests without Internet Information Services (IIS) </li></ul><ul><li>Managed API for HTTP.SYS </li></ul><ul><ul><li>HTTP 1.0/1.1, authentication, SSL </li></ul></ul><ul><ul><li>Shares ports (Microsoft ® Windows Server™ 2003 or higher) </li></ul></ul><ul><li>Synchronous/asynchronous </li></ul><ul><li>HttpListenerRequest/HttpListenerResponse </li></ul>
  18. 18. Demonstration Six HTTP Listener
  19. 19. Session Summary <ul><li>Your SmartClient app can be smart about network availability and configuration </li></ul><ul><li>Mail support is versatile and standards-based (and completely managed code now!) </li></ul><ul><li>Using request/response pattern is easy when using FTP or HTTP </li></ul><ul><li>Communications via sockets is easier than ever to secure </li></ul><ul><li>HTTP Listener allows you to handle web requests in scenarios where IIS isn’t appropriate </li></ul>
  20. 20. Additional Resources <ul><li>All about System.Net.Mail </li></ul><ul><ul><li>http://www.systemnetmail.com </li></ul></ul><ul><li>Series of articles on FTP </li></ul><ul><ul><li>http://blogs.msdn.com/adarshk/archive/category/7225.aspx </li></ul></ul><ul><li>Comprehensive example of HTTP Listener </li></ul><ul><ul><li>http://weblogs.asp.net/pglavich/archive/2005/09/04/424392.aspx </li></ul></ul>

×