Exemplo n.º 1
0
        /// <summary>
        /// Logs into the host server using the provided credentials.
        /// </summary>
        /// <exception cref="ArgumentNullException">If <paramref name="username"/> or <paramref name="password"/> are null.</exception>
        /// <param name="username">A <see cref="String" /> type representing the user name with which to authenticate.</param>
        /// <param name="password">A <see cref="String" /> type representing the password with which to authenticate.</param>
        public void Login(string username, string password)
        {
            if (username == null)
            {
                throw new ArgumentNullException("username");
            }

            if (password == null)
            {
                throw new ArgumentNullException("password");
            }

            {
            }
            _hConnect = WININET.InternetConnect(_hInternet,
                                                Host,
                                                Port,
                                                username,
                                                password,
                                                WININET.INTERNET_SERVICE_FTP,
                                                WININET.INTERNET_FLAG_PASSIVE,
                                                IntPtr.Zero);

            if (_hConnect == IntPtr.Zero)
            {
                Error();
            }
        }
Exemplo n.º 2
0
 public void Login(string username, string password)
 {
     if (username == null)
     {
         throw new ArgumentNullException("username");
     }
     if (password == null)
     {
         throw new ArgumentNullException("password");
     }
     _hConnect = WININET.InternetConnect(_hInternet, Host, Port, username, password, 1, 0x800_0000, IntPtr.Zero);
     if (_hConnect == IntPtr.Zero)
     {
         Error();
     }
 }