DefaultHttpHandler 클래스
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
기본 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
- 구현
예제
다음 코드 예제에서는 클래스에서 DefaultHttpHandler 파생 하 여 사용자 지정 된 HTTP 처리기를 구현 하는 방법을 보여 줍니다.
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에 도입된 와일드카드 애플리케이션 매핑 기능을 통해 설정할 수 있습니다.
클래스는 DefaultHttpHandlerIHttpAsyncHandler 비동기 요청 처리를 제공하는 인터페이스를 구현합니다. HTTP 처리기에 대한 일반적인 내용은 HTTP 처리기 및 HTTP 모듈 개요를 참조하세요. 또한 자세한 내용은 다음을 참조하세요.
비동기 HTTP 처리기를 만드는 방법에 대한 자세한 내용은 연습: 비동기 HTTP 처리기 만들기를 참조하세요.
HTTP 처리기 등록에 대한 자세한 내용은 방법: HTTP 처리기 등록을 참조하세요.
클래스는 클래스에서 DefaultHttpHandler 파생되어 요청의 사용자 지정 처리를 제공할 수 있습니다. 메서드에서 파생된 비동기 HTTP 처리기는 메서드를 재정의 DefaultHttpHandlerBeginProcessRequest 하여 요청 처리 방법을 변경할 수 있습니다.
DefaultHttpHandler ASP.NET 오류를 사용하지 않습니다. IIS 오류 또는 독점적인 ISAPI 사용자 지정 오류 메커니즘을 사용하는 기존 콘텐츠는 변경되지 않고 작동합니다.
생성자
| Name | Description |
|---|---|
| DefaultHttpHandler() |
DefaultHttpHandler 클래스의 새 인스턴스를 초기화합니다. |
속성
| Name | Description |
|---|---|
| Context |
현재 DefaultHttpHandler 개체와 연결된 컨텍스트를 가져옵니다. |
| ExecuteUrlHeaders |
요청 헤더 및 요청과 함께 전송할 요청 값의 컬렉션을 가져옵니다. |
| IsReusable |
다른 요청이 클래스의 DefaultHttpHandler 현재 인스턴스를 사용할 수 있음을 나타내는 부울 값을 가져옵니다. |
메서드
| Name | Description |
|---|---|
| BeginProcessRequest(HttpContext, AsyncCallback, Object) |
HTTP 처리기에 대한 비동기 호출을 시작합니다. |
| EndProcessRequest(IAsyncResult) |
비동기 프로세스에 대한 엔드 메서드를 제공합니다. |
| Equals(Object) |
지정된 개체가 현재 개체와 같은지 여부를 확인합니다. (다음에서 상속됨 Object) |
| GetHashCode() |
기본 해시 함수로 사용됩니다. (다음에서 상속됨 Object) |
| GetType() |
현재 인스턴스의 Type 가져옵니다. (다음에서 상속됨 Object) |
| MemberwiseClone() |
현재 Object단순 복사본을 만듭니다. (다음에서 상속됨 Object) |
| OnExecuteUrlPreconditionFailure() |
사전 조건이 개체가 DefaultHttpHandler 요청을 처리하지 못하게 할 때 호출됩니다. |
| OverrideExecuteUrlPath() |
현재 요청에 대한 대상 URL을 재정의합니다. |
| ProcessRequest(HttpContext) |
개체가 DefaultHttpHandler HTTP 웹 요청을 처리할 수 있도록 합니다. |
| ToString() |
현재 개체를 나타내는 문자열을 반환합니다. (다음에서 상속됨 Object) |