Share via


HttpListener.UnsafeConnectionNtlmAuthentication Özellik

Tanım

NTLM kullanıldığında kimlik doğrulaması için aynı İletim Denetimi Protokolü (TCP) bağlantısını kullanan ek isteklerin gerekip gerekmediğini denetleyebilen bir Boolean değer alır veya ayarlar.

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

Özellik Değeri

trueIIdentity ilk isteğin aynı bağlantıdaki sonraki istekler için kullanılıp kullanılmayacağı; aksi takdirde , false. false varsayılan değerdir.

Özel durumlar

Bu nesne kapatıldı.

Örnekler

Aşağıdaki kod örneğinde bu özelliğin ayarlanması gösterilmektedir.

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

Açıklamalar

Bu özellik olarak ayarlandığında true ve belirli bir TCP bağlantısı üzerindeki ilk istek NTLM kullanılarak doğrulandığında, aynı TCP bağlantısı üzerinden yapılan sonraki istekler ilk isteğin kimlik doğrulama bilgileri (IIdentity) kullanılarak işlenir.

NTLM kimlik doğrulama protokolü olmadığında bu özelliğin hiçbir etkisi olmaz. Kimlik doğrulama protokolü olarak Negotiate belirtildiğinde, bu özelliğin etkisi yalnızca NTLM kimlik doğrulaması için kullanılan gerçek protokol olduğunda olur.

Not

ek NTLM kimlik doğrulaması sınamaları göndermediğinden bu özelliğin true performansı HttpListener artıracak şekilde ayarlanmasına karşın, tüm isteklerin kimlik doğrulama bilgilerini sağlamasını gerektirmeme açısından bir güvenlik riski vardır. Performans artışının bu riske değip değmeyeceğini belirlemeniz gerekir.

Şunlara uygulanır