Session contains a sequence of requests for various functions in different states. Requests in different states have different opportunities to turn themselves to be profitable. A scalable server should also provide different levels of Quality of service to requests in different states in each session so that profitable requests like order and checkout can be completed in a timely manner.
main.aspx
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace _2DSession
{
public partial class home1 : System.Web.UI.Page
{
protected void Page_Load(object sender, System.EventArgs e)
{
codings cl=new codings();
DataSet dt=cl.sessioncheck(Session["aa"].ToString());
int sum;
sum=0;
for(int i=0;i<dt.Tables[0].Rows.Count;i++)
{
sum=sum + Convert.ToInt32(dt.Tables[0].Rows[i].ItemArray[0].ToString());
}
Session["ss"]=Convert.ToString(sum);
int j=Convert.ToInt32(Session["ss"].ToString());
if(j<2000)
{
if(Page.IsPostBack==false)
{
DateTime time=(DateTime)Session["starttime"];
TimeSpan ts=DateTime.Now.Subtract(time);
if(ts.TotalSeconds>30)
{
Session.Abandon();
Response.Redirect("home.aspx");
}
}
}
else if(j>2000)
{
if(Page.IsPostBack==false)
{
DateTime time=(DateTime)Session["starttime"];
TimeSpan ts=DateTime.Now.Subtract(time);
if(ts.TotalSeconds>60)
{
Session.Abandon();
Response.Redirect("home.aspx");
}
}
}
else if(j>5000)
{
if(Page.IsPostBack==false)
{
DateTime time=(DateTime)Session["starttime"];
TimeSpan ts=DateTime.Now.Subtract(time);
if(ts.TotalSeconds>300)
{
Session.Abandon();
Response.Redirect("home.aspx");
}
}
}
if(Session["aa"].ToString()=="")
{
Response.Redirect("logout.aspx");
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}
private void InitializeComponent()
{
}
#endregion
protected void LinkButton1_Click(object sender, System.EventArgs e)
{
Session["aa"]="";
Response.Redirect("logout.aspx");
}
}
}
home.aspx
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace _Session
{
public partial class bdetails : System.Web.UI.Page
{
protected void Page_Load(object sender, System.EventArgs e)
{
codings cl=new codings();
DataSet dt=cl.sessioncheck(Session["aa"].ToString());
int sum;
sum=0;
for(int i=0;i<dt.Tables[0].Rows.Count;i++)
{
sum=sum + Convert.ToInt32(dt.Tables[0].Rows[i].ItemArray[0].ToString());
}
Session["ss"]=Convert.ToString(sum);
int j=Convert.ToInt32(Session["ss"].ToString());
if(j<2000)
{
if(Page.IsPostBack==false)
{
DateTime time=(DateTime)Session["starttime"];
TimeSpan ts=DateTime.Now.Subtract(time);
if(ts.TotalSeconds>30)
{
Session.Abandon();
Response.Redirect("home.aspx");
}
}
}
else if(j>2000)
{
if(Page.IsPostBack==false)
{
DateTime time=(DateTime)Session["starttime"];
TimeSpan ts=DateTime.Now.Subtract(time);
if(ts.TotalSeconds>60)
{
Session.Abandon();
Response.Redirect("home.aspx");
}
}
}
else if(j>5000)
{
if(Page.IsPostBack==false)
{
DateTime time=(DateTime)Session["starttime"];
TimeSpan ts=DateTime.Now.Subtract(time);
if(ts.TotalSeconds>300)
{
Session.Abandon();
Response.Redirect("home.aspx");
}
}
}
if(Session["aa"].ToString()=="")
{
Response.Redirect("logout.aspx");
}
codings cl1=new codings();
DataSet dt1=cl1.branch1();
int a=dt1.Tables[0].Rows.Count ;
DropDownList1.Items.Add("---select---");
for(int i=0;i<a;i++)
{
DropDownList1.Items.Add(dt1.Tables[0].Rows[i].ItemArray[0].ToString());
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}
private void InitializeComponent()
{
}
#endregion
protected void DropDownList1_SelectedIndexChanged(object sender, System.EventArgs e)
{
codings cs=new codings();
DataSet dt1=cs.branch12(DropDownList1.SelectedItem.Text);
txtbname.Text=dt1.Tables[0].Rows[0].ItemArray[1].ToString();
txtplace.Text=dt1.Tables[0].Rows[0].ItemArray[2].ToString();
txtaddress.Text=dt1.Tables[0].Rows[0].ItemArray[3].ToString();
txtpnumber.Text=dt1.Tables[0].Rows[0].ItemArray[4].ToString();
txtmail.Text=dt1.Tables[0].Rows[0].ItemArray[5].ToString();
}
protected void LinkButton1_Click(object sender, System.EventArgs e)
{
Session["aa"]="";
Response.Redirect("logout.aspx");
}
}
}


|