您的位置:首页 > 移动开发

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);

}
}

//============================================
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: