HttpListener.UnsafeConnectionNtlmAuthentication 속성

정의

NTLM이 사용될 때 동일한 TCP(Transmission Control Protocol) 연결을 사용하는 추가 요청을 인증해야 하는지 여부를 제어하는 Boolean 값을 가져오거나 설정합니다.

public:
 property bool UnsafeConnectionNtlmAuthentication { bool get(); void set(bool value); };
public bool UnsafeConnectionNtlmAuthentication { get; set; }
member this.UnsafeConnectionNtlmAuthentication : bool with get, set
Public Property UnsafeConnectionNtlmAuthentication As Boolean

속성 값

Boolean

첫 번째 요청의 IIdentity가 동일한 연결에서 후속 요청에 사용되면 true이고, 그렇지 않으면 false입니다. 기본값은 false입니다.

예외

이 개체가 닫힌 경우.

예제

다음 코드 예제에서는이 속성을 설정 하는 방법을 보여 줍니다.

public static void SimpleListenerWithUnsafeAuthentication(string[] prefixes)
{
    // URI prefixes are required,
    // for example "http://contoso.com:8080/index/".
    if (prefixes == null || prefixes.Length == 0)
      throw new ArgumentException("prefixes");
    // Set up a listener.
    HttpListener listener = new HttpListener();
    foreach (string s in prefixes)
    {
        listener.Prefixes.Add(s);
    }
    listener.Start();
    // Specify Negotiate as the authentication scheme.
    listener.AuthenticationSchemes = AuthenticationSchemes.Negotiate;
    // If NTLM is used, we will allow multiple requests on the same
    // connection to use the authentication information of first request.
    // This improves performance but does reduce the security of your
    // application.
    listener.UnsafeConnectionNtlmAuthentication = true;
    // This listener does not want to receive exceptions
    // that occur when sending the response to the client.
    listener.IgnoreWriteExceptions = true;
    Console.WriteLine("Listening...");
    // ... process requests here.

    listener.Close();
}
Public Shared Sub SimpleListenerWithUnsafeAuthentication(ByVal prefixes As String())
    ' URI prefixes are required,
    ' for example "http://contoso.com:8080/index/".
    If prefixes Is Nothing OrElse prefixes.Length = 0 Then Throw New ArgumentException("prefixes")
    ' Set up a listener.
    Dim listener As HttpListener = New HttpListener()

    For Each s As String In prefixes
        listener.Prefixes.Add(s)
    Next

    listener.Start()
    ' Specify Negotiate as the authentication scheme.
    listener.AuthenticationSchemes = AuthenticationSchemes.Negotiate
    ' If NTLM Is used, we will allow multiple requests on the same
    ' connection to use the authentication information of first request.
    ' This improves performance but does reduce the security of your 
    ' application. 
    listener.UnsafeConnectionNtlmAuthentication = True
    ' This listener does Not want to receive exceptions 
    ' that occur when sending the response to the client.
    listener.IgnoreWriteExceptions = True
    Console.WriteLine("Listening...")
    ' ... process requests here.

    listener.Close()
End Sub

설명

이 속성이 설정 true 되고 특정 TCP 연결에 대한 첫 번째 요청이 NTLM을 사용하여 인증되면 동일한 TCP 연결에 대한 후속 요청은 초기 요청의 인증 정보(IIdentity)를 사용하여 처리됩니다.

NTLM이 인증 프로토콜이 아닌 경우에는 이 속성이 적용되지 않습니다. Negotiate가 인증 프로토콜로 지정된 경우 이 속성은 NTLM이 인증에 사용되는 실제 프로토콜인 경우에만 적용됩니다.

참고

이 속성을 설정하면 true 추가 NTLM 인증 문제가 전송되지 않으므로 성능 HttpListener 이 향상되지만 모든 요청에서 인증 정보를 제공하지 않아도 되는 보안 위험이 있습니다. 성능 향상이 이 위험의 가치가 있는지 여부를 결정해야 합니다.

적용 대상