InternetOpenUrl and HttpQueryInfo returns 403


2003-08-04 07:08:53 PM
delphi261
Hi,
I'm using the following code to validate the existance of an URL:
hService := InternetOpenUrl(FSession,LPCTSTR(sUrl), Nil,0,
INTERNET_FLAG_NO_COOKIES or
INTERNET_FLAG_NO_UI or
INTERNET_FLAG_NO_CACHE_WRITE or
INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS or
INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP or
INTERNET_FLAG_DONT_CACHE or
INTERNET_FLAG_PRAGMA_NOCACHE or
INTERNET_FLAG_RELOAD or
INTERNET_FLAG_IGNORE_CERT_DATE_INVALID,
DWORD(@FInfos));
Right after this call I use HttpQueryInfo to get the http status code such
as 200 (HTTP_STATUS_OK), 404 (HTTP_STATUS_NOT_FOUND)...
iStatusCode := 0;
lSize := SizeOf(iStatusCode);
HttpQueryInfo(hService, HTTP_QUERY_STATUS_CODE or
HTTP_QUERY_FLAG_NUMBER,
@iStatusCode, lSize, lpdwReserved);
However even if the URL is valid and still exists iStatusCoda always returns
403 (HTTP_STATUS_FORBIDDEN) for simple URLs like www.borland.com.
Do you know why this happens?
cu,
Michael