New/Improved System.Net features in Whidbey Beta 2

Well now that Whidbey beta2 has been released, I wanted to mention some of the new features that have been added to this release from the System.Net namespace view point. With the usual bug fixes we have introduced some new features in Smtp, Udp, Ssl Sessions , remote server certificate validation callback and Caching.

Smtp:

We now have added support for sending Multipart/Related mails using System.Net.Mail namespace. You will find some new classes such as LinkedResource which lets users add resources to their alternate views. Also you will find some API changes in Attachment(which extends to AlternateView and LinkedResource class) to make creating and adding attachments more intutive.

Another big feature added is the support for dropping emails in a DropFolder to be picked up for routing by your mail server and if you are using SMTP in IIS, then you can drop mails in the PickupDirectory location of the IIS mail server. So now we have three modes for Smtp delivery (found in SmtpDeliveryMethod):  Network,SpecifiedPickupDirectory and PickupDirectoryFromIis.

Udp Packet Origin:

A new API has been added to Socket, Socket.ReceiveMessageFrom (It also has an async version in BeginReceiveMessageFrom/EndReceiveMessageFrom) that on reception of an UDP packet denotes the kind of Udp packet that it received. i.e now you can programatically determine whether the UDP packet that you received is a Broadcast/Unicast/Multicast packet and whether the packet was Truncated/Control Data Truncated for IPV6. This is a very cool feature if you have apps that predominatly use UDP packets and wanted to protect it from surge of unwanted UDP packets. This API also informs you the network interface number on which the particular packet was received from. I will post more detailed post on this API later.

Ssl Session Reuse:

This is a "under the hood" kind of feature. To summarize it, the framework  will now reuse SslSessions to a particualr server when ever its possible to reuse them. This reuse is a free performance improving facility where your apps that does SSL handshake with remote servers will pick on a already established SSL session with a remote server and try to reconnect. This however depends on the remote server and so one can assume that SSL sessions reuse will happen whenever the remote server allows it. That means we will always try to reuse a session to a particualr server if one already exists and if the remote server doesnt challenge/deny that reconnect request, we will ride on that session. This feature is available to all schemes that use SSL such as Http, Ftp, Smtp and also available if you are using SslStream class.

Caching:

We now have added support for enabling caching in Http and Ftp requests.

 

UPDATE:

Oops, I forgot to mention another crucial feature in Smtp, We now support SSL for SMTP servers that supports SSL. All you have to do to enable is set SmtpClient.EnableSsl property to true..