zoukankan      html  css  js  c++  java
  • Net 常用代码

    循环输出cookie信息

    for (int i = 0; i < Request.Cookies.Count; i++)
    {
    HttpCookie cookies
    = Request.Cookies[i];
    Response.Write(
    "name=" + cookies.Name + "<br>");
    if (cookies.HasKeys)
    {
    System.Collections.Specialized.NameValueCollection Namecall
    = cookies.Values;
    for (int j = 0; j < Namecall.Count; j++)
    {
    Response.Write(
    "子键名=" + Namecall.AllKeys[j] + "<br/>");
    Response.Write(
    "子键值=" + Namecall[j] + "<br/>");
    }
    }
    else
    {
    Response.Write(
    "value=" + cookies.Value + "<br/>");
    }
    }

    第二种代码着色!

    for (int i = 0; i < Request.Cookies.Count; i++)
            {
                HttpCookie cookies = Request.Cookies[i];
                Response.Write("name=" + cookies.Name + "<br>");
                if (cookies.HasKeys)
                {
                    System.Collections.Specialized.NameValueCollection Namecall = cookies.Values;
                    for (int j = 0; j < Namecall.Count; j++)
                    {
                        Response.Write("子键名=" + Namecall.AllKeys[j] + "<br/>");
                        Response.Write("子键值=" + Namecall[j] + "<br/>");
                    }
                }
                else
                {
                    Response.Write("value=" + cookies.Value + "<br/>");
                }
            }
    
    System.Web.HttpContext.Current.Server.MapPath()
    System.Web.HttpContext.Current.Session
    System.Web.HttpContext.Current.Response
    string spath = HttpContext.Current.Request.Path; /productlist.aspx
    HttpContext.Current.Request.UrlReferrer//获取上一页面地址
    Context.Request.UserHostAddress
  • 相关阅读:
    正则匹配、替换
    C# 算法
    .Net Core 初体验及总结(内含命令大全)
    docker 开放 2375端口
    docker 中 mysql group by 报错
    微信小程序全局变量改变监听
    Linux 中 IDEA 不能调试(Debug)项目
    JavaMail发送邮件后再通过JavaMail接收格式问题
    Linux 安装 RabbitMQ
    SpringBoot 集成 Swagger
  • 原文地址:https://www.cnblogs.com/neve/p/1997754.html
Copyright © 2011-2022 走看看