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++之Static与Const
    LInux主机与虚拟机网络链接
    C#数据类型与数据类型转化
    C#网编Console(二)
    C#网编Winform(三)
    C#网编基础类与API(一)
    C实现CPU大小端判断
    QT程序图标设置
    四、初识Socket套接字API
    C++之继承(二)
  • 原文地址:https://www.cnblogs.com/neve/p/1997754.html
Copyright © 2011-2022 走看看