using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class DisplaySession : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["UserName"] != null && Session["Password"] != null)
{
lblUserName.Text = Session["UserName"].ToString();
lblPassord.Text = Session["Password"].ToString();
}
else
{
lblPassord.Text = Session["Password"].ToString();
lblUserName.Text = string.Empty;
}
}
protected void btnLogoutAbandon_Click(object sender, EventArgs e)
{
//For occupied memory location and Value
if (Session["UserName"] != null && Session["Password"] != null)
{
//For Clear Particul Value
Session.Abandon();
Response.Redirect("Default.aspx");
}
}
protected void btnLogoutClear_Click(object sender, EventArgs e)
{
//For Clear Only Session Values
if (Session["UserName"] != null && Session["Password"] != null)
{
//For Clear Particul Value
Session.Clear();
Response.Redirect("Default.aspx");
}
}
protected void btnLogoutRemove_Click(object sender, EventArgs e)
{
if (Session["UserName"] != null && Session["Password"] != null)
{
//For Clear Particul Value
Session.Remove("UserName");
Response.Redirect("Default.aspx");
}
}
}