context.items.add()这个内容在什么情况下用呀?
1. context.items.add()的命名空间为System.Collections.IDictionary HttpContext.Current.Items 是IHttpModule 与 IHttpHandler 交互数据的一个集合, 返回System.Collections.IDictionary
Context.Items意义一样,也return回System.Collections.IDictionary
不过Context是相对性(相对当前), 而HttpContext.Current是绝对性的
2. HttpContext类的常用公共属性有:
Application,为当前 HTTP 请求获取HttpApplicationState 对象。
Current, 为当前 HTTP 请求获取 HttpContext 对象。
Handler, 为当前 HTTP 请求获取或设置 IHttpHandler 对象。
Items,获取可用于在 HTTP 请求过程中在 IHttpModule 和 IHttpHandler 之间组织和共享数据的键值集合。
Request,为当前 HTTP 请求获取 HttpRequest 对象。
Response,为当前 HTTP 响应获取 HttpResponse 对象。
Server, 获取提供用于处理 Web 请求的方法的 HttpServerUtility 对象。
Session, 为当前 HTTP 请求获取 HttpSessionState 实例。
通过Page类的Context属性可以获得当前的System.Web.HttpContext对象3. 由于看到例子有这么个代码才想起来: protected void bt_Subit_Click(object sender, EventArgs e)
{
//查询需求
string townName = drp_Town.SelectedValue;
string villageName = drp_Village.SelectedValue == "请选择所在村/社区" ? "" : drp_Village.SelectedValue;
string kind = "";
string time = txt_Time.Value == "请选择添加的时间" ? "" : txt_Time.Value;
string num = txt_Num.Value == "请输入查询的编号" ? "" : txt_Num.Value;
string keyword = "";
//打包页面传值 到searchconteng.aspx
//content
Context.Items.Add("townName", townName);
Context.Items.Add("villageName", villageName);
Context.Items.Add("kind", kind);
Context.Items.Add("time", time); Context.Items.Add("num", num);
Context.Items.Add("keyword", keyword);
Server.Transfer("/searchcontent.aspx");
}
1. context.items.add()的命名空间为System.Collections.IDictionary HttpContext.Current.Items 是IHttpModule 与 IHttpHandler 交互数据的一个集合, 返回System.Collections.IDictionary
Context.Items意义一样,也return回System.Collections.IDictionary
不过Context是相对性(相对当前), 而HttpContext.Current是绝对性的
2. HttpContext类的常用公共属性有:
Application,为当前 HTTP 请求获取HttpApplicationState 对象。
Current, 为当前 HTTP 请求获取 HttpContext 对象。
Handler, 为当前 HTTP 请求获取或设置 IHttpHandler 对象。
Items,获取可用于在 HTTP 请求过程中在 IHttpModule 和 IHttpHandler 之间组织和共享数据的键值集合。
Request,为当前 HTTP 请求获取 HttpRequest 对象。
Response,为当前 HTTP 响应获取 HttpResponse 对象。
Server, 获取提供用于处理 Web 请求的方法的 HttpServerUtility 对象。
Session, 为当前 HTTP 请求获取 HttpSessionState 实例。
通过Page类的Context属性可以获得当前的System.Web.HttpContext对象3. 由于看到例子有这么个代码才想起来: protected void bt_Subit_Click(object sender, EventArgs e)
{
//查询需求
string townName = drp_Town.SelectedValue;
string villageName = drp_Village.SelectedValue == "请选择所在村/社区" ? "" : drp_Village.SelectedValue;
string kind = "";
string time = txt_Time.Value == "请选择添加的时间" ? "" : txt_Time.Value;
string num = txt_Num.Value == "请输入查询的编号" ? "" : txt_Num.Value;
string keyword = "";
//打包页面传值 到searchconteng.aspx
//content
Context.Items.Add("townName", townName);
Context.Items.Add("villageName", villageName);
Context.Items.Add("kind", kind);
Context.Items.Add("time", time); Context.Items.Add("num", num);
Context.Items.Add("keyword", keyword);
Server.Transfer("/searchcontent.aspx");
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货