Session

Chanikya
Posted by Chanikya under ASP.NET category on | Points: 40 | Views : 1777
Session.aspx


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Session.aspx.cs" Inherits="Session" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<p> Name
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</p>
<p> Desigenaton
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</p>
<p> Company
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
</p>
<p>Exp
<asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
</p>
<asp:Button ID="Button1" runat="server" Text="Submit" onclick="Button1_Click" />
</div>
</form>
</body>
</html>



Session.aspx.cs


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Session : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Button1_Click(object sender, EventArgs e)
{
Session["Name"] = TextBox1.Text.ToString();
Session["Desigenaton"] = TextBox2.Text.ToString();
Session["Company"] = TextBox3.Text.ToString();
Session["Exp"] = TextBox4.Text.ToString();
Response.Redirect("~/session1.aspx");
}
}




Session1.aspx


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="session1.aspx.cs" Inherits="session1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.style1
{
text-align: center;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div class="style1">
<asp:Label ID="Label1" runat="server" Text=""></asp:Label>
<br />
<asp:Label ID="Label2" runat="server" Text=""></asp:Label>
<br />
<asp:Label ID="Label3" runat="server" Text=""></asp:Label>
<br />
<asp:Label ID="Label4" runat="server" Text=""></asp:Label>
</div>
</form>
</body>
</html>



Session1.aspx.cs


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class session1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = Session["Name"].ToString();
Label2.Text = Session["Desigenaton"].ToString();
Label3.Text = Session["Company"].ToString();
Label4.Text = Session["Exp"].ToString();

}
}





hhttp://facebook.com/chanikya.chowdary

http://labs.google.co.in/smschannels/subscribe/My-Heart2U

http://smsgupshup.com/groups/friends4ever66

Comments or Responses

Login to post response