m_adil
asked on
using TWebBrowser ....
Hi,
How can i get the status code returned by the web server using TWebBrowser. status code means the code that web server returns in case of error (i.e. 404 for file not found etc, etc)
Thanks
How can i get the status code returned by the web server using TWebBrowser. status code means the code that web server returns in case of error (i.e. 404 for file not found etc, etc)
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The indy http client vcl will give you access to the headers too. I've searched high & low, tried many things, but I do not know how to get this info from IE.
GL
Mike
GL
Mike
Question(s) below appears to have been abandoned. Your options are:
1. Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you. You must tell the participants why you wish to do this, and allow for Expert response.
3. Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4. Delete the question. Again, please comment to advise the other participants why you wish to do this.
For special handling needs, please post a zero point question in the link below and include the question QID/link(s) that it regards.
https://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
Please click the Help Desk link on the left for Member Guidelines, Member Agreement and the Question/Answer process. https://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp
Please click you Member Profile to view your question history and keep them all current with updates as the collaboration effort continues, to track all your open and locked questions at this site. If you are an EE Pro user, use the Power Search option to find them.
To view your open questions, please click the following link(s) and keep them all current with updates.
https://www.experts-exchange.com/questions/Q.20085964.html
https://www.experts-exchange.com/questions/Q.20125173.html
https://www.experts-exchange.com/questions/Q.20191794.html
https://www.experts-exchange.com/questions/Q.20230267.html
https://www.experts-exchange.com/questions/Q.20260346.html
PLEASE DO NOT AWARD THE POINTS TO ME.
------------> EXPERTS: Please leave any comments regarding your closing recommendations if this item remains inactive another seven (7) days. Also, if you are interested in the cleanup effort, please click this link https://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=commspt&qid=20274643
Thank you everyone.
P.S. For any year 2000 questions, special attention is needed to ensure the first correct response is awarded, since they are not in the comment date order, but rather in Member ID order.
1. Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you. You must tell the participants why you wish to do this, and allow for Expert response.
3. Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4. Delete the question. Again, please comment to advise the other participants why you wish to do this.
For special handling needs, please post a zero point question in the link below and include the question QID/link(s) that it regards.
https://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
Please click the Help Desk link on the left for Member Guidelines, Member Agreement and the Question/Answer process. https://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp
Please click you Member Profile to view your question history and keep them all current with updates as the collaboration effort continues, to track all your open and locked questions at this site. If you are an EE Pro user, use the Power Search option to find them.
To view your open questions, please click the following link(s) and keep them all current with updates.
https://www.experts-exchange.com/questions/Q.20085964.html
https://www.experts-exchange.com/questions/Q.20125173.html
https://www.experts-exchange.com/questions/Q.20191794.html
https://www.experts-exchange.com/questions/Q.20230267.html
https://www.experts-exchange.com/questions/Q.20260346.html
PLEASE DO NOT AWARD THE POINTS TO ME.
------------> EXPERTS: Please leave any comments regarding your closing recommendations if this item remains inactive another seven (7) days. Also, if you are interested in the cleanup effort, please click this link https://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=commspt&qid=20274643
Thank you everyone.
P.S. For any year 2000 questions, special attention is needed to ensure the first correct response is awarded, since they are not in the comment date order, but rather in Member ID order.
***********************
Uses:Wininet;
procedure WBBeforeNavigate2(Sender: TObject;
const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData,
Headers: OleVariant; var Cancel: WordBool);
var
sAppName: string;
hSession, hURL: HInternet;
pBuffer: DWORD;
BufferLength, Index: DWORD;
Status: integer;
begin
sAppName := ExtractFileName(Applicatio
Status := 0;
hSession := InternetOpen(PChar(sAppNam
if hSession <> nil then
try
hURL := InternetOpenURL(hSession, PChar(VarToStr(URL)), nil, 0, INTERNET_FLAG_NO_CACHE_WRI
Index := 0;
BufferLength := 20;
if HttpQueryInfo(hURL, HTTP_QUERY_STATUS_CODE + HTTP_QUERY_FLAG_NUMBER, @pBuffer, BufferLength, Index) then
Status := pBuffer;
try
if Status <> 200 then
begin
Cancel := True;
ShowMessage('HTTP Status Code Is: ' + IntToStr(Status));
end;
finally
InternetCloseHandle(hURL);
end;
finally
InternetCloseHandle(hSessi
end;
end;
*********************
Rick