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";
  }

}

posted @ 2014-12-19 17:15  @睦  阅读(1809)  评论(0编辑  收藏  举报