Condividi tramite


HttpURLConnection.ResponseCode Property

Definition

Gets the status code from an HTTP response message.

public virtual Java.Net.HttpStatus ResponseCode { [Android.Runtime.Register("getResponseCode", "()I", "GetGetResponseCodeHandler")] get; }
[<get: Android.Runtime.Register("getResponseCode", "()I", "GetGetResponseCodeHandler")>]
member this.ResponseCode : Java.Net.HttpStatus

Property Value

the HTTP Status-Code, or -1

Attributes

Exceptions

if there is an IO error during the retrieval.

Remarks

Gets the status code from an HTTP response message. For example, in the case of the following status lines:

HTTP/1.0 200 OK
            HTTP/1.0 401 Unauthorized

It will return 200 and 401 respectively. Returns -1 if no code can be discerned from the response (i.e., the response is not valid HTTP).

Java documentation for java.net.HttpURLConnection.getResponseCode().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

See also