CWebView::GetHttpStatus Method  
 
INT GetHttpStatus();

The GetHttpStatus method returns the HTTP status code from the last completed navigation.

Parameters

None.

Return Value

If the method succeeds, the return value is a non-zero status code. If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

This method returns the HTTP status code from the server response associated with the last completed navigation. These codes are defined by the HTTP standard and indicate the outcome of the request:

  • 100-199: Informational responses indicating the request is in progress.
  • 200-299: Successful responses, with 200 (OK) being the most common.
  • 300-399: Redirects, such as 301 (Moved Permanently) or 302 (Found).
  • 400-499: Client errors, such as 403 (Forbidden) or 404 (Not Found).
  • 500-599: Server errors, such as 500 (Internal Server Error) or 503 (Service Unavailable).

It is important to note that this value is only meaningful once navigation has completed. During a series of redirects, the status code may change multiple times; the value returned will be from the final response that completed navigation. A return value of 0 indicates the HTTP status code is unavailable. It may also return zero when the browser has navigated to a local file or when HTML content has been supplied directly using the SetDocumentText method.

Requirements

Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools12.h
Import Library: cshtmv12.lib

See Also