Exemplo n.º 1
0
 public void Open()
 {
     if (string.IsNullOrEmpty(Host))
     {
         throw new ArgumentNullException("Host");
     }
     _hInternet = WININET.InternetOpen(Environment.UserName, 0, null, null, 4);
     if (_hInternet == IntPtr.Zero)
     {
         Error();
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Establishes a connection to the host.
        /// </summary>
        /// <exception cref="ArgumentNullException">If Host is null or empty.</exception>
        public void Open()
        {
            if (String.IsNullOrEmpty(Host))
            {
                throw new ArgumentNullException("Host");
            }

            _hInternet = WININET.InternetOpen(
                System.Environment.UserName,
                WININET.INTERNET_OPEN_TYPE_PRECONFIG,
                null,
                null,
                WININET.INTERNET_FLAG_SYNC);

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