Application1.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Application1.aspx.cs" Inherits="Application1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table class="auto-style1">
<tr>
<td class="auto-style3">UserName</td>
<td class="auto-style2">
<asp:TextBox ID="USERTextBox" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style4"> </td>
<td>
<asp:Button ID="SUBMITButton" runat="server" OnClick="SUBMITButton_Click" Text="Submit" />
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
Application1.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 Application1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void SUBMITButton_Click(object sender, EventArgs e)
{
Application["user"] = USERTextBox.Text;
Response.Redirect("Application2.aspx");
}
}
Application2.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Application2.aspx.cs" Inherits="Application2" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:LinkButton ID="LinkButton1" runat="server" PostBackUrl="~/Session3.aspx">GoToSession3</asp:LinkButton>
</div>
</form>
</body>
</html>
Application2.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 Application2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Application["user"] != null)
{
Response.Write("Welcome" + Application["user"].ToString());
}
else
{
Response.Redirect("Session1.aspx");
}
}
}
Application3.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Application3.aspx.cs" Inherits="Application3" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="LOGOUT" />
</div>
</form>
</body>
</html>
Application3.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 Application3 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Application["user"] != null)
{
Response.Write("Welcome" + Application["user"].ToString());
}
else
{
Response.Redirect("Session1.aspx");
}
}
protected void Button1_Click(object sender, EventArgs e)
{
Application["user"] = null;
Response.Redirect("Application1.aspx");
}
}
0 Comments