평가 및 의견을 보내려면 클릭하십시오.
MSDN
MSDN Library
.NET 개발
이전 버전
.NET Framework SDK 2.0
Class Library Reference
System.Net
HttpListenerContext 클래스

  저대역폭 보기 설정
이 페이지에서 다루는 특정 제품:.
Microsoft Visual Studio 2005/.NET Framework 2.0

다음 제품들은 다른 버전에서 다루어 집니다.
.NET Framework 클래스 라이브러리
HttpListenerContext 클래스

참고: 이 클래스는 .NET Framework 버전 2.0에서 새로 추가되었습니다.

HttpListener 클래스에서 사용되는 요청 및 응답 개체에 액세스할 수 있도록 합니다. 이 클래스는 상속될 수 없습니다.

네임스페이스: System.Net
어셈블리: System(system.dll)

Visual Basic(선언)
Public NotInheritable Class HttpListenerContext
Visual Basic(사용법)
Dim instance As HttpListenerContext
C#
public sealed class HttpListenerContext
C++
public ref class HttpListenerContext sealed
J#
public final class HttpListenerContext
JScript
public final class HttpListenerContext

이 클래스는 HttpListener 개체에서 처리되는 클라이언트의 HTTP(Hypertext Transfer Protocol) 요청과 관련된 정보를 제공합니다. GetContext 메서드는 HttpListenerContext 클래스의 인스턴스를 반환합니다. 클라이언트 요청을 나타내는 개체를 가져오려면 Request 속성을 사용합니다. HttpListener에서 클라이언트에 보낼 응답을 나타내는 개체를 가져오려면 Response 속성을 사용합니다. 로그인 이름 및 인증 여부와 같이 요청을 보내는 클라이언트에 대한 사용자 정보를 가져오려면 User 속성에서 반환되는 IPrincipal 개체의 속성을 쿼리합니다.

HttpListenerContext 개체를 닫으면 클라이언트에 응답이 보내지고 HttpListenerContext에서 사용한 리소스가 모두 해제됩니다. HttpListenerContext 개체를 중단하면 클라이언트에 응답을 아직 보내지 않은 경우 해당 응답이 삭제되고 HttpListenerContext에서 사용한 리소스가 모두 해제됩니다. HttpListenerContext 개체를 닫거나 중단한 후에는 이 개체의 메서드 또는 속성을 참조할 수 없습니다. 이 메서드나 속성을 참조하려고 하면 ObjectDisposedException 예외가 발생합니다.

Windows XP Home Edition, Windows XP Professional x64 Edition, Windows Server 2003 플랫폼 참고: HttpListener 클래스를 사용하려면 서비스 팩 2가 필요합니다.

다음 코드 예제에서는 클라이언트 요청에 대한 사용자 정보를 표시합니다.

C#
public static bool RemoveAllPrefixes(HttpListener listener)
{
    // Get the prefixes that the Web server is listening to.
    HttpListenerPrefixCollection prefixes = listener.Prefixes;
    try 
    {
        prefixes.Clear();
    } 
    // If the operation failed, return false.
    catch
    {
        return false;
    }
    return true;
}
System.Object
  System.Net.HttpListenerContext
이 형식의 모든 public static(Visual Basic의 경우 Shared) 멤버는 스레드로부터 안전합니다. 인터페이스 멤버는 스레드로부터 안전하지 않습니다.

Windows 98, Windows Server 2003, Windows XP Media Center Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

.NET Framework

2.0에서 지원
커뮤니티 콘텐츠   커뮤니티 콘텐츠란?
새 콘텐츠 추가 RSS  주석
Processing
© 2009 Microsoft Corporation. All rights reserved. 사용약관  |  상표  |  개인정보보호
Page view tracker