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
  • 相关阅读:
    51nod 1031+斐波那契和杨辉三角的一些基础知识
    51nod 1297
    萌新二叉树学习笔记
    HDU3415【单调队列】
    萌新瞎讲网络流之最大流【不定期更新理解篇】
    萌新浅谈单调队列
    51nod 1021【区间DP】
    51nod 1278【贪心】
    51nod 1413
    51nod1181【素数筛】
  • 原文地址:https://www.cnblogs.com/neve/p/1997754.html
Copyright © 2011-2022 走看看