HttpResponseHeaderCollection.Location Properti
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
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
Nilai Properti
Objek yang mewakili nilai header HTTP Lokasi pada respons HTTP. Nilai null berarti header tidak ada.
Keterangan
Kode sampel berikut menunjukkan metode untuk mengatur header Lokasi pada objek HttpResponseMessage menggunakan properti Lokasi pada objek 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());
}
Berlaku untuk
Lihat juga
Saran dan Komentar
https://aka.ms/ContentUserFeedback.
Segera hadir: Sepanjang tahun 2024 kami akan menghentikan penggunaan GitHub Issues sebagai mekanisme umpan balik untuk konten dan menggantinya dengan sistem umpan balik baru. Untuk mengetahui informasi selengkapnya, lihat:Kirim dan lihat umpan balik untuk