Newsgroups : Microsoft : microsoft.public.inetsdk.programming.wininet : 2005 Nov : InternetOpenUrl freezes if wrong username/password entered by user

www.cryer.info
Managed Newsgroup Archive

InternetOpenUrl freezes if wrong username/password entered by user

Subject:InternetOpenUrl freezes if wrong username/password entered by user
Posted by:"Abe Simpson" (a..@simpson.com)
Date:Mon, 28 Nov 2005 15:57:19

Hi all,

I have this pretty standard code that downloads a file from a URL:

resend:
  objUrl.m_h = ::InternetOpenUrl( hSession, bstrEncUrl, m_bstrAuth,
m_bstrAuth.Length(), INTERNET_FLAG_NO_CACHE_WRITE |
INTERNET_FLAG_IGNORE_CERT_DATE_INVALID |
INTERNET_FLAG_IGNORE_CERT_CN_INVALID, NULL );

  BOOL bRes = ::HttpQueryInfoA( objUrl.m_h, HTTP_QUERY_FLAG_NUMBER |
HTTP_QUERY_STATUS_CODE, &dwCode, &dw2, 0 );

  if( dwCode == 401 )
  {
   DWORD dwError;
   dwError = ::InternetErrorDlg(m_hWnd, objUrl.m_h, ERROR_SUCCESS,
            FLAGS_ERROR_UI_FILTER_FOR_ERRORS |
            FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS |
            FLAGS_ERROR_UI_FLAGS_GENERATE_DATA,
            NULL);

   if( dwError == ERROR_INTERNET_FORCE_RETRY )
    goto resend;
  }


Now, this code does pop-up a login dialog box when necessary, and if I enter
the correct username/password, everything works great. However if I enter an
incorrect username/password, the dialog shows up the 2nd time, and if I keep
enterting incorrect login info, the next call to InternetOpenUrl simply
freezes, and the application freezes with it!

Anyone can shed any light?

Thanks in advance.

-- Abe

Replies:

www.cryer.info
Managed Newsgroup Archive