DefaultHttpHandler 클래스

정의

기본 HTTP 처리기의 속성 및 메서드를 나타냅니다.

public ref class DefaultHttpHandler : System::Web::IHttpAsyncHandler
public class DefaultHttpHandler : System.Web.IHttpAsyncHandler
type DefaultHttpHandler = class
    interface IHttpAsyncHandler
    interface IHttpHandler
Public Class DefaultHttpHandler
Implements IHttpAsyncHandler
상속
DefaultHttpHandler
구현

예제

다음 코드 예제에서 파생 하 여 사용자 지정된 HTTP 처리기를 구현 하는 방법에 설명 합니다 DefaultHttpHandler 클래스입니다.

public class AsyncDefaultHttpHandler : DefaultHttpHandler
{
    private HttpContext _context;

    public override IAsyncResult BeginProcessRequest(
      HttpContext context, AsyncCallback callback, object state)
    {
        AsyncResultSample ar = new AsyncResultSample(callback, state);
        _context = context;

        return ar;
    }

    public override void EndProcessRequest(IAsyncResult result)
    {
        _context.Response.Write("EndProcessRequest called.");
    }

    // This method should not be called asynchronously.
    public override void ProcessRequest(HttpContext context)
    {
        throw new InvalidOperationException(
                  "Asynchronous processing failed.");
    }

    // Enables pooling when set to true
    public override bool IsReusable
    {
        get { return true; }
    }
}

// Tracks state between the begin and end calls.
class AsyncResultSample : IAsyncResult
{
    private AsyncCallback callback = null;
    private Object asyncState;
    private Boolean isCompleted;

    internal AsyncResultSample(AsyncCallback cb, Object state)
    {
        this.callback = cb;
        asyncState = state;
        isCompleted = false;
    }

    public object AsyncState
    {
        get
        {
            return asyncState;
        }
    }

    public bool CompletedSynchronously
    {
        get
        {
            return false;
        }
    }

    public WaitHandle AsyncWaitHandle
    {
        get
        {
            throw new InvalidOperationException(
                      "ASP.NET should not use this property .");
        }
    }

    public bool IsCompleted
    {
        get
        {
            return isCompleted;
        }
    }

    internal void SetCompleted()
    {
        isCompleted = true;
        if (callback != null)
        {
            callback(this);
        }
    }
}
Public Class defaulthttpexampleVB
    Inherits DefaultHttpHandler

    Private _context As HttpContext

    Public Overrides Function BeginProcessRequest _
        (ByVal context As HttpContext, _
         ByVal callback As AsyncCallback, _
         ByVal state As Object) As IAsyncResult

        Dim ar As New AsyncResultSample(callback, state)
        _context = context

        Return (ar)
    End Function

    Public Overrides Sub EndProcessRequest(ByVal result As IAsyncResult)
        _context.Response.Write("EndProcessRequest called.")
    End Sub

    ' This method should not be called asynchronously.
    Public Overrides Sub ProcessRequest(ByVal context As HttpContext)
        Throw New InvalidOperationException _
          ("Asynchronous processing failed.")
    End Sub

    ' Enables pooling when set to true
    Public Overrides ReadOnly Property IsReusable() As Boolean
        Get
            Return True
        End Get
    End Property
End Class

' Tracks state between the begin and end calls.
Class AsyncResultSample
    Implements IAsyncResult
    Private callback As AsyncCallback = Nothing
    Private _asyncState As Object
    Private _isCompleted As Boolean

    Friend Sub New(ByVal cb As AsyncCallback, ByVal state As Object)
        Me.callback = cb
        _asyncState = state
        _isCompleted = False
    End Sub

    Public ReadOnly Property AsyncState() As Object _
      Implements IAsyncResult.AsyncState
        Get
            Return _asyncState
        End Get
    End Property

    Public ReadOnly Property CompletedSynchronously() _
      As Boolean Implements IAsyncResult.CompletedSynchronously
        Get
            Return False
        End Get
    End Property

    Public ReadOnly Property AsyncWaitHandle() _
      As WaitHandle Implements IAsyncResult.AsyncWaitHandle
        Get
            Throw New InvalidOperationException _
              ("ASP.NET should not use this property .")
        End Get
    End Property

    Public ReadOnly Property IsCompleted() _
      As Boolean Implements IAsyncResult.IsCompleted
        Get
            Return IsCompleted
        End Get
    End Property

    Friend Sub SetCompleted()
        _isCompleted = True
        If (callback <> Nothing) Then
            callback(Me)
        End If
    End Sub
End Class

설명

DefaultHttpHandler 요청 가로채기가 인터넷 정보 서비스 (IIS) 6.0를 통해 구성 및 요청된 된 확장에 명시적 바인딩이 적용 하는 경우 개체는 HTTP 파이프라인에서 들어오는 요청을 차단 합니다.

IIS 6.0에 도입 된 와일드 카드 애플리케이션 매핑 기능을 통해 요청 인터 셉 션을 설정할 수 있습니다.

합니다 DefaultHttpHandler 구현 클래스는 IHttpAsyncHandler 비동기 요청 처리를 제공 하는 인터페이스입니다. HTTP 처리기에 대 한 일반적인 정보를 참조 하세요 HTTP 처리기 및 HTTP 모듈 개요합니다. 또한 자세한 내용은 다음을 참조 합니다.

클래스에서 파생할 수는 DefaultHttpHandler 요청의 사용자 지정된 처리를 제공 하는 클래스입니다. 파생 되는 비동기 HTTP 처리기를 DefaultHttpHandler 재정의할 수는 BeginProcessRequest 요청 처리 방법을 변경 하는 방법입니다.

DefaultHttpHandler ASP.NET 오류를 사용 하지 않습니다. 기존 콘텐츠 IIS 오류를 사용 하는 또는 독점 ISAPI 사용자 지정 오류 메커니즘을 변경 되지 않습니다.

생성자

DefaultHttpHandler()

DefaultHttpHandler 클래스의 새 인스턴스를 초기화합니다.

속성

Context

현재 DefaultHttpHandler 개체와 관련된 컨텍스트를 가져옵니다.

ExecuteUrlHeaders

요청과 함께 전송할 요청 헤더와 요청 값의 컬렉션을 가져옵니다.

IsReusable

다른 요청에서 DefaultHttpHandler 클래스의 현재 인스턴스를 사용할 수 있는지 여부를 나타내는 부울 값을 가져옵니다.

메서드

BeginProcessRequest(HttpContext, AsyncCallback, Object)

HTTP 처리기에 대한 비동기 호출을 시작합니다.

EndProcessRequest(IAsyncResult)

비동기 프로세스를 위한 end 메서드를 제공합니다.

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

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

기본 해시 함수로 작동합니다.

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

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

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

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

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

전제 조건에 따라 DefaultHttpHandler 개체에서 요청을 처리하지 못하는 경우 호출됩니다.

OverrideExecuteUrlPath()

현재 요청에 대해 대상 URL을 재정의합니다.

ProcessRequest(HttpContext)

DefaultHttpHandler 개체가 HTTP 웹 요청 프로세스를 처리할 수 있습니다.

ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

적용 대상

추가 정보