URLConnection.GetHeaderField Method

Definition

Overloads

GetHeaderField(String)

Returns the value of the named header field.

GetHeaderField(Int32)

Returns the value for the n<sup>th</sup> header field.

GetHeaderField(String)

Returns the value of the named header field.

[Android.Runtime.Register("getHeaderField", "(Ljava/lang/String;)Ljava/lang/String;", "GetGetHeaderField_Ljava_lang_String_Handler")]
public virtual string? GetHeaderField (string? name);
[<Android.Runtime.Register("getHeaderField", "(Ljava/lang/String;)Ljava/lang/String;", "GetGetHeaderField_Ljava_lang_String_Handler")>]
abstract member GetHeaderField : string -> string
override this.GetHeaderField : string -> string

Parameters

name
String

the name of a header field.

Returns

the value of the named header field, or null if there is no such field in the header.

Attributes

Remarks

Returns the value of the named header field.

If called on a connection that sets the same header multiple times with possibly different values, only the last value is returned.

Java documentation for java.net.URLConnection.getHeaderField(java.lang.String).

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

GetHeaderField(Int32)

Returns the value for the n<sup>th</sup> header field.

[Android.Runtime.Register("getHeaderField", "(I)Ljava/lang/String;", "GetGetHeaderField_IHandler")]
public virtual string? GetHeaderField (int n);
[<Android.Runtime.Register("getHeaderField", "(I)Ljava/lang/String;", "GetGetHeaderField_IHandler")>]
abstract member GetHeaderField : int -> string
override this.GetHeaderField : int -> string

Parameters

n
Int32

an index, where n>=0

Returns

the value of the n<sup>th</sup> header field or null if there are fewer than n+1 fields

Attributes

Remarks

Returns the value for the n<sup>th</sup> header field. It returns null if there are fewer than n+1fields.

This method can be used in conjunction with the #getHeaderFieldKey(int) getHeaderFieldKey method to iterate through all the headers in the message.

Java documentation for java.net.URLConnection.getHeaderField(int).

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