System.Net.Mime.ContentDisposition Class

Represents a MIME protocol Content-Disposition header.

See Also: ContentDisposition Members


public class ContentDisposition


The information in the System.Net.Mime.ContentDisposition class accompanies an e-mail message that contains attachments when the e-mail message is sent to its destination. The information in System.Net.Mime.ContentDisposition can be used by software that displays e-mail to present the e-mail attachments in the manner intended by the sender.

E-mail messages are created using instances of the System.Net.Mail.MailMessage class. Instances of the System.Net.Mail.Attachment class are used to add attachments to e-mail messages. To modify the System.Net.Mime.ContentDisposition for an attachment, get the instance from the System.Net.Mail.Attachment.ContentDisposition property.

Content to be displayed as part of the message body has the disposition type of ContentDisposition.Inline. Content that is not displayed but is attached in a separate file has the disposition type of DispositionTypeNames.Attachment. Use the ContentDisposition.Inline property to control the disposition type for the attachment associated with an instance of System.Net.Mime.ContentDisposition.

For file attachments, you can use the properties of the System.Net.Mime.ContentDisposition to set the file size, as well as the date the file was created, last read, and last modified. For all attachments, you can set a recommended file name in the event that the attachment is stored on the receiving computer.

The ContentDisposition.ToString method returns the Content-Disposition header. The Content-Disposition header is described in RFC 2183 available at tp://


Namespace: System.Net.Mime
Assembly: System (in System.dll)
Assembly Versions:,
Since: .NET 2.0