Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Roll no: 35
Subject:ASP.net
Assignment -3
Q-1 roll no,name,gender,qualification,date of birth submit button display all the data using
querystring,cookies,application.
Querystring:
SOURCE CODE
<html xmlns="http://www.w3.org/1999/xhtml">
<title></title>
<style type="text/css">
.style1
width: 78px;
.style2
width: 347px;
.style3
Page | 14
height: 25px;
.style4
height: 25px;
width: 347px;
</style>
</head>
<body>
<tr>
</td>
<td class="style2">
</td>
</tr>
<tr><td>
</td><td class="style2">
</td></tr>
Page | 15
<tr><td class="style3">
</td></tr>
<tr><td>
</td><td class="style2">
</td></tr>
<tr><td>
</td><td class="style2">
</td></tr>
</td></tr>
</table>
</form>
</body>
Page | 16
</html>
Click event
Partial Class v1
Inherits System.Web.UI.Page
If r1.Checked Then
gen = r1.Text
Else
gen = r2.Text
End If
Dim q As String
If c1.Checked Then
q = q + c1.Text
End If
If c2.Checked Then
End If
If c3.Checked Then
End If
If c4.Checked Then
End If
Page | 17
Response.Redirect("v2.aspx?roll=" & t1.Text & "&name=" & t2.Text & "&g=" & gen & "&q=" & q &
"&dob=" & t4.Text)
End Sub
End Class
Second page:
SOURCE CODE
<html xmlns="http://www.w3.org/1999/xhtml">
<title></title>
<style type="text/css">
.style1
width: 321px;
height: 23px;
.style4
height: 22px;
width: 62px;
.style5
width: 62px;
Page | 18
}
.style6
width: 62px;
height: 23px;
</style>
</head>
<body>
<div>
<table>
<tr><td class="style6">
</td>
<td class="style1">
</td></tr>
<tr><td class="style4">
</td><td class="style1">
</td></tr>
<tr><td class="style5">
Page | 19
</td><td>
</td></tr>
<tr><td class="style5">
</td><td>
</td></tr>
<tr><td class="style5">
</td><td>
</td></tr>
</table>
</div>
</form>
</body>
</html>
Click event
Partial Class v2
Inherits System.Web.UI.Page
l2.Text = Request.QueryString("roll")
l4.Text = Request.QueryString("name")
Page | 20
l5.Text = Request.QueryString("g")
l6.Text = Request.QueryString("q")
l7.Text = Request.QueryString("dob")
End Sub
End Class
Cookie :
SOURCE CODE
<html xmlns="http://www.w3.org/1999/xhtml">
<title></title>
</head>
<body>
<div>
<tr>
</td>
<td class="style2">
</td>
</tr>
Page | 21
<tr><td>
</td><td class="style2">
</td></tr>
<tr><td class="style3">
</td></tr>
<tr><td>
</td><td class="style2">
</td></tr>
<tr><td>
</td><td class="style2">
</td></tr>
Page | 22
<asp:Button ID="b1" runat="server" Text="submit" />
</td></tr>
</table>
</div>
</form>
</body>
</html>
Click event
Partial Class v3
Inherits System.Web.UI.Page
Dim g As String
If r1.Checked Then
g = r1.Text
Else
g = r2.Text
End If
Dim q As String
If c1.Checked Then
q = q + c1.Text
End If
If c2.Checked Then
End If
If c3.Checked Then
Page | 23
q = q + " " + c3.Text
End If
If c4.Checked Then
End If
Response.Cookies("roll").Value = t1.Text
Response.Cookies("name").Value = t2.Text
Response.Cookies("gender").Value = g
Response.Cookies("quli").Value = q
Response.Cookies("dob").Value = t4.Text
Response.Redirect("v4.aspx")
End Sub
Second page:
SOURCE CODE
<html xmlns="http://www.w3.org/1999/xhtml">
<title></title>
<style type="text/css">
.style1
width: 34px;
Page | 24
</style>
</head>
<body>
<div>
<table>
<tr><td class="style1">
</td>
<td class="style1">
</td></tr>
<tr><td class="style4">
</td><td class="style1">
</td></tr>
<tr><td>
</td><td>
</td></tr>
<tr><td>
</td><td>
Page | 25
<asp:Label ID="l6" runat="server" Text="Label"></asp:Label>
</td></tr>
<tr><td>
</td><td>
</td></tr>
</table>
</div>
</form>
</body>
</html>
Click event
Partial Class v4
Inherits System.Web.UI.Page
l2.Text = Request.Cookies("roll").Value
l4.Text = Request.Cookies("name").Value
l5.Text = Request.Cookies("gender").Value
l6.Text = Request.Cookies("quli").Value
l7.Text = Request.Cookies("dob").Value
End Sub
End Class
Application :
SOURCE CODE
Page | 26
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="v5.aspx.vb" Inherits="v5" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<title></title>
<style type="text/css">
.style1
height: 46px;
.style2
height: 47px;
.style3
height: 48px;
.style4
height: 50px;
.style5
height: 79px;
Page | 27
}
</style>
</head>
<body>
<div>
<tr>
</td>
<td class="style2">
</td>
</tr>
<tr><td>
</td><td class="style2">
</td></tr>
<tr><td class="style3">
Page | 28
</td></tr>
<tr><td class="style5">
</td><td class="style5">
</td></tr>
<tr><td>
</td><td class="style2">
</td></tr>
</td></tr>
</table>
</div>
</form>
</body>
</html>
Page | 29
Click event
Partial Class v5
Inherits System.Web.UI.Page
Dim g As String
If r1.Checked Then
g = r1.Text
Else
g = r2.Text
End If
Dim q As String
If c1.Checked Then
q = q + c1.Text
End If
If c2.Checked Then
End If
If c3.Checked Then
End If
If c4.Checked Then
End If
Page | 30
Application("roll") = t1.Text
Application("name") = t2.Text
Application("gender") = g
Application("quli") = q
Application("dob") = t4.Text
Response.Redirect("v6.aspx")
End Sub
End Class
Second page:
SOURCE CODE
<html xmlns="http://www.w3.org/1999/xhtml">
<title></title>
</head>
<body>
<div>
<table>
<tr><td class="style1">
Page | 31
</td>
<td class="style2">
</td></tr>
<tr><td class="style4">
</td><td class="style3">
</td></tr>
<tr><td>
</td><td>
</td></tr>
<tr><td>
</td><td>
</td></tr>
<tr><td>
</td><td>
</td></tr>
</table>
Page | 32
</div>
</form>
</body>
</html>
Click event
Partial Class v6
Inherits System.Web.UI.Page
l2.Text = Application("roll").ToString
l4.Text = Application("name").ToString
l5.Text = Application("gender").ToString
l6.Text = Application("quli").ToString
l7.Text = Application("dob").ToString
End Sub
End Class
Page | 33
output
Page | 34
Name: Mehul patel
Roll no: 35
Subject:ASP.net
Q-2 user id ,password button and pass the data using session.
SOURCE CODE
<html xmlns="http://www.w3.org/1999/xhtml">
<title></title>
<style type="text/css">
.style1
height: 24px;
.style2
width: 59px;
.style3
height: 24px;
Page | 35
width: 59px;
</style>
</head>
<body>
<div>
<table><tr><td class="style2">
</td><td>
</td></tr>
<tr><td class="style3">
</td><td class="style1">
</td></tr>
</td></tr></table>
</div>
</form>
</body>
</html>
Page | 36
Click event
Partial Class v1
Inherits System.Web.UI.Page
Session("unm") = t1.Text
Session("pass") = t2.Text
Response.Redirect("v2.aspx")
End Sub
End Class
Second page:
SOURCE CODE
<html xmlns="http://www.w3.org/1999/xhtml">
<title></title>
<style type="text/css">
.style1
height: 23px;
</style>
</head>
<body>
Page | 37
<div>
<table><tr><td class="style1">
</td><td class="style1">
</td></tr>
</td></tr></table>
</div>
</form>
</body>
</html>
Click event
Partial Class v2
Inherits System.Web.UI.Page
If (IsNothing(Session("unm"))) Then
Response.Redirect("session.aspx")
End If
l3.Text += Session("unm")
End Sub
Page | 38
Protected Sub b1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles b1.Click
Session.Abandon()
FormsAuthentication.SignOut()
Response.Redirect("v1.aspx")
End Sub
End Class
Output
Page | 39