Request.Params["ID"](小结)

从页面的

QueryString 、Form、Cookies、ServerVariables 里检索名称为“ID”的值。包括控件ID 和name

优先级顺序为
QueryString > Form > Cookies > ServerVariables



以下是来自 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);
}

Request.QueryString Get值(一般是URL)

Request.Form post值(一般是name)

Request[] get post

原文地址:https://www.cnblogs.com/cuihongyu3503319/p/1496741.html