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

BeginAuthenticateAsClient() public method

public BeginAuthenticateAsClient ( System credential, string targetName, System requiredProtectionLevel, System allowedImpersonationLevel, System asyncCallback, object asyncState ) : System.IAsyncResult
credential System
targetName string
requiredProtectionLevel System
allowedImpersonationLevel System
asyncCallback System
asyncState object
return System.IAsyncResult
        public virtual System.IAsyncResult BeginAuthenticateAsClient(System.Net.NetworkCredential credential, string targetName, System.Net.Security.ProtectionLevel requiredProtectionLevel, System.Security.Principal.TokenImpersonationLevel allowedImpersonationLevel, System.AsyncCallback asyncCallback, object asyncState) { throw null; }
        public virtual System.IAsyncResult BeginAuthenticateAsClient(System.Net.NetworkCredential credential, System.Security.Authentication.ExtendedProtection.ChannelBinding binding, string targetName, System.Net.Security.ProtectionLevel requiredProtectionLevel, System.Security.Principal.TokenImpersonationLevel allowedImpersonationLevel, System.AsyncCallback asyncCallback, object asyncState) { throw null; }

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 ( NetworkCredential credential, string targetName, ProtectionLevel requiredProtectionLevel, TokenImpersonationLevel allowedImpersonationLevel, 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 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