HttpRequestHeaderCollection.MaxForwards 属性

定义

获取或设置一个整数值,该值代表 HTTP 请求中 Max-Forwards HTTP 标头的值。

public:
 property IReference<unsigned int> ^ MaxForwards { IReference<unsigned int> ^ get(); void set(IReference<unsigned int> ^ value); };
IReference<uint32_t> MaxForwards();

void MaxForwards(IReference<uint32_t> value);
public System.Nullable<uint> MaxForwards { get; set; }
var iReference = httpRequestHeaderCollection.maxForwards;
httpRequestHeaderCollection.maxForwards = iReference;
Public Property MaxForwards As Nullable(Of UInteger)

属性值

IReference<UInt32>

Nullable<UInt32>

Windows.Foundation.IReference

IReference<uint32_t>

一个整数值,表示 HTTP 请求中 Max-Forwards HTTP 标头的值。 null 值表示标头不存在。

注解

下面的示例代码演示了一个方法,该方法使用 HttpRequestHeaderCollection 对象的 MaxForwards 属性在 HttpRequestMessage 对象上设置 Max-Forwards 标头。

public void DemonstrateHeaderRequestMaxForwards() {
    var request = new HttpRequestMessage();

    // Set the header with an integer.
    request.Headers.MaxForwards= 2;

    // Get the strong type out
    System.Diagnostics.Debug.WriteLine("MaxForwards value: {0}", request.Headers.MaxForwards);
}

适用于

另请参阅