Take the 2-minute tour ×

I'm trying to get Wininet to ignore Internet Explorer's "Work Offline" mode, for both HTTP and FTP.

So I'm trying to use InternetSetOption() with INTERNET_OPTION_IGNORE_OFFLINE. The documentation says "This is used by InternetQueryOption and InternetSetOption with a request handle." However, you can't get a request handle because if IE is in Work Offline mode then InternetConnect() will always return a null handle. Without a connection handle you can't get a request handle. So I tried using it with an InternetOpen() handle and a NULL handle. Both failed with ERROR_INTERNET_INCORRECT_HANDLE_TYPE.

Is there a way to get this option to work? I found a reference on an MS newsgroup from 2003 that INTERNET_OPEN_TYPE_PRECONFIG is "broken". 5 years later with IE8 beta 2 and they still haven't fixed it? Or am I doing it wrong.

I wasn't quite correct. InternetConnect() always returns null if you are on "Work Offline" mode and using FTP, but it returns a valid handle if you are using Http. However, it still doesn't work even with a request handle.

If I am set to "Work Offline" and I call

::InternetSetOption(hData, INTERNET_OPTION_IGNORE_OFFLINE, &a, sizeof(BOOL));

on the handle from

HINTERNET hData = HttpOpenRequest(hInternet, L"POST", path, NULL, NULL, NULL, flags, 0 );

the InternetSetOption() call succeeds.
However, the call to HttpSendRequest() still fails with error code 2 (file not found), same as it does if I don't set the option.
Same thing if I call

::InternetSetOption(hData, INTERNET_OPTION_IGNORE_OFFLINE, 0, 0);
share|improve this question
add comment

2 Answers

I checked use of INTERNET_OPTION_IGNORE_OFFLINE with the IE 9 version of WinInet and it does seem to work.

Make sure you call InternetSetOption before you call HttpOpenRequest and pass in the hInternet handle instead. The option must be set before the request actually gets sent to the server. HttpOpenRequest

+++ Rick ---

share|improve this answer
add comment

Did you tried GET instead of POST which sends additional data in headers?

For example in REST-ful API POST request is equivalent to Create, Update, Delete and GET to Read and that might break the offline mode. Just guessing...

share|improve this answer
add comment

Your Answer


