HttpResponseHeaderCollection.Location Propiedad

Definición

Obtiene o establece el URI que representa el valor o un encabezado HTTP de ubicación en una respuesta HTTP.

public:
 property Uri ^ Location { Uri ^ get(); void set(Uri ^ value); };
Uri Location();

void Location(Uri value);
public System.Uri Location { get; set; }
var uri = httpResponseHeaderCollection.location;
httpResponseHeaderCollection.location = uri;
Public Property Location As Uri

Valor de propiedad

Objeto que representa el valor de un encabezado HTTP de ubicación en una respuesta HTTP. Un valor NULL significa que el encabezado no está presente.

Comentarios

El código de ejemplo siguiente muestra un método para establecer el encabezado Location en un objeto HttpResponseMessage mediante la propiedad Location del objeto HttpResponseHeaderCollection .

public void DemonstrateHeaderResponseLocation() {
    var response = new HttpResponseMessage();

    // Set the header with a strong type.
    response.Headers.Location = new Uri("http://example.com/");

    // Get the strong type out
    System.Diagnostics.Debug.WriteLine("Location absolute uri: {0}", response.Headers.Location.AbsoluteUri);

    // The ToString() is useful for diagnostics, too.
    System.Diagnostics.Debug.WriteLine("The Location ToString() results: {0}", response.Headers.Location.ToString());
}

Se aplica a

Consulte también