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
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
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步