System.Net.Security.NegotiateStream.BeginAuthenticateAsClient C# (CSharp) Method

BeginAuthenticateAsClient() public method

public BeginAuthenticateAsClient ( NetworkCredential credential, string targetName, ProtectionLevel requiredProtectionLevel, TokenImpersonationLevel allowedImpersonationLevel, AsyncCallback asyncCallback, object asyncState ) : IAsyncResult
credential NetworkCredential
targetName string
requiredProtectionLevel ProtectionLevel
allowedImpersonationLevel TokenImpersonationLevel
asyncCallback AsyncCallback
asyncState object
return IAsyncResult
        public virtual IAsyncResult BeginAuthenticateAsClient(
            NetworkCredential credential,
            string targetName,
            ProtectionLevel requiredProtectionLevel,
            TokenImpersonationLevel allowedImpersonationLevel,
            AsyncCallback asyncCallback,
            object asyncState)
        {
            return BeginAuthenticateAsClient(credential, null, targetName,
                                             requiredProtectionLevel, allowedImpersonationLevel,
                                             asyncCallback, asyncState);
        }

Same methods

NegotiateStream::BeginAuthenticateAsClient ( AsyncCallback asyncCallback, object asyncState ) : IAsyncResult
NegotiateStream::BeginAuthenticateAsClient ( NetworkCredential credential, ChannelBinding binding, string targetName, AsyncCallback asyncCallback, object asyncState ) : IAsyncResult
NegotiateStream::BeginAuthenticateAsClient ( NetworkCredential credential, ChannelBinding binding, string targetName, ProtectionLevel requiredProtectionLevel, TokenImpersonationLevel allowedImpersonationLevel, AsyncCallback asyncCallback, object asyncState ) : IAsyncResult
NegotiateStream::BeginAuthenticateAsClient ( NetworkCredential credential, string targetName, AsyncCallback asyncCallback, object asyncState ) : IAsyncResult
NegotiateStream::BeginAuthenticateAsClient ( System credential, System binding, string targetName, System requiredProtectionLevel, System allowedImpersonationLevel, System asyncCallback, object asyncState ) : System.IAsyncResult
NegotiateStream::BeginAuthenticateAsClient ( System credential, System binding, string targetName, System asyncCallback, object asyncState ) : System.IAsyncResult
NegotiateStream::BeginAuthenticateAsClient ( System asyncCallback, object asyncState ) : System.IAsyncResult
NegotiateStream::BeginAuthenticateAsClient ( System credential, string targetName, System requiredProtectionLevel, System allowedImpersonationLevel, System asyncCallback, object asyncState ) : System.IAsyncResult
NegotiateStream::BeginAuthenticateAsClient ( System credential, string targetName, System asyncCallback, object asyncState ) : System.IAsyncResult

Usage Example

Example #1
0
        private void AuthCallback(IAsyncResult ar)
        {
            try
            {
                NegotiateStream nsCb = (NegotiateStream)ar.AsyncState;
                nsCb.EndAuthenticateAsClient(ar);
                nsCb.BeginRead(buffer, 0, buffer.Length, ReceiveCallback, nsCb);
                authenticated = true;
            }
            catch (Exception e)
            {
                authenticated = false;
                Console.WriteLine(e.Message);

                Console.WriteLine("Введите логин:");
                login = Console.ReadLine();
                while (login.Length == 0)
                {
                    Console.WriteLine("Введите логин:");
                    login = Console.ReadLine();
                }
                Console.WriteLine("Введите пароль:");
                password = Console.ReadLine();
                nws = new NetworkStream(socket);
                ns = new NegotiateStream(nws, true);
                netCred = new NetworkCredential(login, password);
                ns.BeginAuthenticateAsClient(netCred, String.Empty, ProtectionLevel.EncryptAndSign, TokenImpersonationLevel.Delegation, AuthCallback, ns);
            }
        }
All Usage Examples Of System.Net.Security.NegotiateStream::BeginAuthenticateAsClient