context.Request.Params

context.Request.Params["ISBN"]ide

是從頁面的QueryString,Form,Cookies,ServerVariables裏面檢索名爲"CategoryID"的值。this

優先級順序爲:spa

QueryString->Form->Cookies->ServerVariablesorm

 

如下是來自 Reflector 的 HttpRequest 類的部分參考代碼。

public NameValueCollection Params
{
    get
    {
        if (HttpRuntime.HasAspNetHostingPermission(AspNetHostingPermissionLevel.Low))
        {
            return this.GetParams();
        }
        return this.GetParamsWithDemand();
    }
}

private NameValueCollection GetParams()
{
    if (this._params == null)
    {
        this._params = new HttpValueCollection(0x40);
        this.FillInParamsCollection();
        this._params.MakeReadOnly();
    }
    return this._params;
}

private void FillInParamsCollection()
{
    this._params.Add(this.QueryString);
    this._params.Add(this.Form);
    this._params.Add(this.Cookies);
    this._params.Add(this.ServerVariables);
}get

參考資料: Reflector
相關文章
相關標籤/搜索