zoukankan      html  css  js  c++  java
  • 获取页面所有参数

    using System.Collections.Specialized; 

    LogHelper.GetInstance().WriteMessage("==============================================================================start");
                NameValueCollection nvc = Request.Form;
                NameValueCollection nvc1 = Request.Params;
                //Params可以获取这三个集合的参数,不过一般不这么用,这个集合比较大,性能不好。所有我们平时都用具体的,要么Form,要么QueryString
                //获取 System.Web.HttpRequest.QueryString、
                //System.Web.HttpRequest.Form、
                //System.Web.HttpRequest.ServerVariables
                
                string[] keys = nvc.AllKeys;
                if (keys == null || keys.Length <= 0)
                {
                    LogHelper.GetInstance().WriteMessage("Request.Form参数Length为0");
                }
                foreach (string k in keys)
                {
                    string key = k;
                    string value = Request.Form[k];
                   
                    LogHelper.GetInstance().WriteMessage(string.Format("Request From key:{0},{2},Value:{1}{2}",key,value,Environment.NewLine));//加个换行符
                
                }

                LogHelper.GetInstance().WriteMessage("==============================================================================end");

  • 相关阅读:
    Django-haystack对接elasticsearch
    Django http 和 https 官网解答
    -bash: nohup: command not found
    Mysql 10060登录异常解决方法
    ssh
    sed grep awk用法
    grep用法
    shell 随笔
    列表生成式
    css
  • 原文地址:https://www.cnblogs.com/zttb/p/9300416.html
Copyright © 2011-2022 走看看