首页 > 代码库 > C# 获取页面get过来的数据

C# 获取页面get过来的数据

/// <summary>
/// 获取get过来的数据
/// </summary>
/// <param name="page"></param>
/// <returns></returns>
private static NameValueCollection GETInput(System.Web.UI.Page page)
{
  return page.Request.QueryString;
}

 

Example:

string Re = "";

public static bool Analysis(string CModule, System.Web.UI.Page page)
{  

  NameValueCollection nvc = GETInput(page);
  if (nvc.Count != 0)
  {
    for (int i = 0; i < nvc.Count; i++)
    {
      Re += "参数名:" + nvc.GetKey(i) + " 值:" + nvc.GetValues(i)[0] + "\r\n";
    }
  }
  else
  {
  Re = "你没有传递任何参数过来!\r\n";
  }

}

C# 获取页面get过来的数据