asp.net 中Session和Application使用
2010-02-26 15:40
477 查看
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//Label1.Text = Request.QueryString["name"];
//Label2.Text = Request.QueryString["email"];
try
{
Label1.Text = Application["name"].ToString();
Label2.Text = Application["email"].ToString();
Application.Remove("name");
Application.Remove("email");
}
catch
{ }
}
protected void Button1_Click(object sender, EventArgs e)
{
Application["name"] = TextBox1.Text;
Application["email"] = TextBox2.Text;
Response.Redirect(HttpContext.Current.Request.Url.PathAndQuery);
}
}
//============================================
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//Label1.Text = Request.QueryString["name"];
//Label2.Text = Request.QueryString["email"];
try
{
Label1.Text = Application["name"].ToString();
Label2.Text = Application["email"].ToString();
Application.Remove("name");
Application.Remove("email");
}
catch
{ }
}
protected void Button1_Click(object sender, EventArgs e)
{
Application["name"] = TextBox1.Text;
Application["email"] = TextBox2.Text;
Response.Redirect(HttpContext.Current.Request.Url.PathAndQuery);
}
}
//============================================
相关文章推荐
- asp.net 使用Application和Session对象统计在线人数
- asp.net中application,cookies,stateview,session的使用
- 在ASP.NET中使用Session与Application 对象
- 在ASP.NET中使用Session与Application 对象(续)
- asp.net中application,cookies,stateview,session的使用
- asp.net中application,cookies,stateview,session的使用
- ASP.NET Web Api中使用Session、Cache和Application的几个方法
- Asp.Net HttpApplication请求管道与Session(二)
- [本周]随手记下 Asp.net中Application Session Cookie ViewState Cache Hidden
- asp.net 中一般应用处理程序使用session
- 在ASP.NET中使用Session
- ASP.NET中自定义类使用Session保存信息
- Asp.net MVC使用Model Binding解除Session, Cookie等依赖
- 部署asp.net时产生“分析器错误:在应用程序级别以外使用注册为 allowDefinition='MachineToApplication' 的节是错误的...”
- ASP.NET中Session高级使用技巧(在非Page类中使用Session)
- cache:缓存在asp.net中如何管理?服务器端缓存?Session, Application, Cache objectscache ,客户端缓存?Cookies,ViewState (转)
- ASP.NET内置对象之Session ,Cookie ,Application
- 使用HttpWebRequest提交ASP.NET表单并保持Session和Cookie
- [转]在ASP.NET中使用Session常见问题集锦
- 轻松实现asp.net中遍历cookies,session,application,小总结