ContentDisposition 클래스

정의

MIME 프로토콜 Content-Disposition 헤더를 나타냅니다.

public ref class ContentDisposition
public class ContentDisposition
type ContentDisposition = class
Public Class ContentDisposition
상속
ContentDisposition

예제

다음 코드 예제에서는 인라인으로 표시할 첨부 파일이 있는 전자 메일 메시지를 만듭니다.

static void CreateMessageInlineAttachment( String^ server, String^ textMessage )
{
   
   // Create a message and set up the recipients.
   MailMessage^ message = gcnew MailMessage( L"jane@contoso.com",L"ben@contoso.com",L"An inline text message for you.",L"Message: " );
   
   // Attach the message string to this email message.
   Attachment^ data = gcnew Attachment( textMessage,MediaTypeNames::Text::Plain );
   
   // Send textMessage as part of the email body.
   message->Attachments->Add( data );
   ContentDisposition^ disposition = data->ContentDisposition;
   disposition->Inline = true;
   
   //Send the message.
   // Include credentials if the server requires them.
   SmtpClient^ client = gcnew SmtpClient( server );
   client->Credentials = CredentialCache::DefaultNetworkCredentials;
   client->Send( message );
   data->~Attachment();
   client->~SmtpClient();
}
public static void CreateMessageInlineAttachment(string server, string
textMessage)
{
    // Create a message and set up the recipients.
    MailMessage message = new MailMessage(
       "jane@contoso.com",
       "ben@contoso.com",
       "An inline text message for you.",
       "Message: ");

    // Attach the message string to this email message.
    Attachment data = new Attachment(textMessage, MediaTypeNames.Text.Plain);
    // Send textMessage as part of the email body.
    message.Attachments.Add(data);
    ContentDisposition disposition = data.ContentDisposition;
    disposition.Inline = true;
    //Send the message.
    // Include credentials if the server requires them.
    SmtpClient client = new SmtpClient(server);
    client.Credentials = CredentialCache.DefaultNetworkCredentials;

    try
    {
        client.Send(message);
    }
    catch (Exception ex)
    {
        Console.WriteLine("Exception caught in CreateMessageInlineAttachment: {0}",
            ex.ToString());
    }
    data.Dispose();
}

설명

클래스의 ContentDisposition 정보는 전자 메일 메시지를 대상으로 보낼 때 첨부 파일이 포함된 전자 메일 메시지와 함께 제공됩니다. 의 정보는 ContentDisposition 전자 메일을 표시하는 소프트웨어에서 보낸 사람 의도대로 전자 메일 첨부 파일을 표시하는 데 사용할 수 있습니다.

Email 메시지는 클래스의 MailMessage 인스턴스를 사용하여 만들어집니다. 클래스의 Attachment 인스턴스는 전자 메일 메시지에 첨부 파일을 추가하는 데 사용됩니다. 첨부 파일의 를 ContentDisposition 수정하려면 속성에서 Attachment.ContentDisposition instance 가져옵니다.

메시지 본문의 일부로 표시할 콘텐츠의 처리 유형은 입니다 Inline. 표시되지 않지만 별도의 파일에 첨부된 콘텐츠의 처리 유형 Attachment은 입니다. 사용 된 속성의 Inline instance ContentDisposition연결 된 첨부 파일에 대 한 처리 유형을 제어 합니다.

파일 첨부 파일의 경우 의 ContentDisposition 속성을 사용하여 파일 크기뿐만 아니라 파일이 만들어진 날짜, 마지막으로 읽은 날짜 및 마지막으로 수정한 날짜를 설정할 수 있습니다. 모든 첨부 파일의 경우 첨부 파일이 받는 컴퓨터에 저장되는 경우 권장되는 파일 이름을 설정할 수 있습니다.

메서드는 ToString Content-Disposition 헤더를 반환합니다. Content-Disposition 헤더는 에서 사용할 수 있는 RFC 2183에 https://www.ietf.org설명되어 있습니다.

생성자

ContentDisposition()

ContentDispositionDispositionType을 사용하여 Attachment 클래스의 새 인스턴스를 초기화합니다.

ContentDisposition(String)

지정된 처리 유형 정보를 사용하여 ContentDisposition 클래스의 새 인스턴스를 초기화합니다.

속성

CreationDate

첨부 파일을 만든 날짜를 가져오거나 설정합니다.

DispositionType

이메일 첨부 파일에 대한 처리 유형을 가져오거나 설정합니다.

FileName

이메일 첨부 파일의 권장 파일 이름을 가져오거나 설정합니다.

Inline

이메일 첨부 파일의 처리 유형(Inline 또는 Attachment)을 결정하는 Boolean 값을 가져오거나 설정합니다.

ModificationDate

첨부 파일을 수정한 날짜를 가져오거나 설정합니다.

Parameters

이 인스턴스에서 나타내는 Content-Disposition 헤더에 포함된 매개 변수를 가져옵니다.

ReadDate

첨부 파일을 읽은 날짜를 가져오거나 설정합니다.

Size

첨부 파일의 크기를 가져오거나 설정합니다.

메서드

Equals(Object)

지정된 ContentDisposition 개체의 content-disposition 헤더가 이 개체의 content-disposition 헤더와 동일한지 여부를 확인합니다.

GetHashCode()

지정된 ContentDisposition 개체의 해시 코드를 확인합니다.

GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

이 인스턴스의 String 표현을 반환합니다.

적용 대상