Exemple #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();
            }
        }
Exemple #2
0
        public void Login(string username, string password)
        {
            _hConnect = WININET.InternetConnect(_hInternet,
                                                _host,
                                                WININET.INTERNET_DEFAULT_FTP_PORT,
                                                username,
                                                password,
                                                WININET.INTERNET_SERVICE_FTP,
                                                WININET.INTERNET_FLAG_PASSIVE,
                                                IntPtr.Zero);

            if (_hConnect == IntPtr.Zero)
            {
                Error();
            }
        }