Share via


HttpContentHeaderCollection.ContentLocation 屬性

定義

取得或設定 HTTP 內容上 HTTP Content-Location 標頭的值。

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

void ContentLocation(Uri value);
public System.Uri ContentLocation { get; set; }
var uri = httpContentHeaderCollection.contentLocation;
httpContentHeaderCollection.contentLocation = uri;
Public Property ContentLocation As Uri

屬性值

HTTP 內容上的 HTTP Content-Location 標頭值。 Null 值表示標頭不存在。

備註

下列範例程式碼示範在 HTTP 內容上使用HttpContentHeaderCollection物件上的 ContentLocation 屬性取得或設定Content-Location標頭值的方法。

// Content-Location header
// Uri
void DemoContentLocation(IHttpContent content) {
    var h = content.Headers;

    h.ContentLocation = new Uri("http://example.com/");

    var header = h.ContentLocation;
    uiLog.Text += "\nCONTENT LOCATION HEADER\n";

    uiLog.Text += string.Format("ContentLocation: ToString: {0}\n\n", header.ToString());
}

適用於

另請參閱