Asp 1-10
Asp 1-10
LOGIN FORM
Program Coding:
Webform1.aspx:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Login Form</title>
<script type="text/javascript">
function showtime()
{
window.setTimeout("showwindow()", 10000);
}
function showwindow()
{
window.location.href = "webform2.aspx";
}
</script>
</head>
<body onload="showtime()">
<form id="form1" runat="server">
<div>
&nbs
p; &nb
sp; &n
bsp; &
nbsp;
&nbs
p; &nb
sp; &n
bsp; Login Form</div>
<p>
&nbs
p; &nb
sp; &n
bsp; &
nbsp;
&nbs
p;
<asp:Label ID="Label1" runat="server" Text="User Name"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server" style="margin-left: 115px; margin-top:
22px"></asp:TextBox>
</p>
<p>
&nbs
p; &nb
sp; &n
bsp; &
nbsp;
&nbs
p;
<asp:Label ID="Label2" runat="server" Text="Password"></asp:Label>
<asp:TextBox ID="TextBox2" runat="server" style="margin-left: 125px; margin-top:
22px"></asp:TextBox>
</p>
<p>
&nbs
p; &nb
sp; &n
bsp; &
nbsp;
&nbs
p; &nb
sp;
<asp:Button ID="Button1" runat="server" Text="Sign In" />
</p>
</form>
</body>
</html>
Webform2.aspx.vb
Public Class WebForm1
Inherits System.Web.UI.Page
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If ((TextBox1.Text = "GNC") And (TextBox2.Text = "123")) Then
Response.Write("Login Successfully")
Else
Response.Write("Invalid Credentials")
End If
End Sub
End Class
Webform2.aspx
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="WebForm2.aspx.vb"
Inherits="ASP1.WebForm2" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
&nbs
p; &nb
sp; &n
bsp; &
nbsp;
&nbs
p;
<asp:Label ID="Label2" runat="server" Font-Bold="True" Font-Size="XX-Large" ForeColor="#FF0066"
Text="Please Try Again Later"></asp:Label>
</div>
</form>
</body></html>
Output:
2. EMPLOYEE DATABASE
Program Coding:
&nbs
p; &nb
sp; &n
bsp; &
nbsp;
<br />
<asp:Label ID="Label5" runat="server" Text="Record Inserted"></asp:Label>
&nbs
p; &nb
sp; &n
bsp; &
nbsp;
&nbs
p; Employee Details<br />
<br />
&nbs
p; &nb
sp; &n
bsp; &
nbsp;
<asp:Label ID="Label1" runat="server" Text="EMP ID"></asp:Label>
&nbs
p;
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
<br />
&nbs
p; &nb
sp; &n
bsp; &
nbsp;
<asp:Label ID="Label2" runat="server" Text="EMP NAME"></asp:Label>
&nbs
p;
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<br />
<br />
&nbs
p; &nb
sp; &n
bsp; &
nbsp;
<asp:Label ID="Label3" runat="server" Text="DESIGNATION"></asp:Label>
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
<br />
<br />
&nbs
p; &nb
sp; &n
bsp; &
nbsp;
<asp:Label ID="Label4" runat="server" Text="SALARY"></asp:Label>
&nbs
p;
<asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
<br />
<br />
&nbs
p; &nb
sp; &n
bsp; &
nbsp;
<asp:Button ID="Button1" runat="server" Text="INSERT" />
<asp:Button ID="Button2" runat="server" Text="UPDATE" />
<asp:Button ID="Button3" runat="server" Text="DELETE" />
</div>
</form>
</body>
</html>
Webform1.aspx.vb
Imports System.Data
Imports System.Data.OleDb
Public Class WebForm1
Inherits System.Web.UI.Page
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim connectString As String = "Provider=Microsoft.jet.OLEDB.4.0;" & " Data Source=E:|Database
File|employee.accdb"
Dim cn As OleDbConnection = New OleDbConnection(connectString)
cn.Open()
Dim selectString As String = "INSERT INTO emp(EmpID,EmpName,Designation,Salary) VALUES ('" &
TextBox1.Text & "', '" & TextBox2.Text & "', '" & TextBox3.Text & "', '" & TextBox4.Text & "')"
Dim cmd As OleDbCommand = New OleDbCommand(selectString, cn)
cmd.ExecuteNonQuery()
cn.Close()
End Sub
OUTPUT
3. REQUEST AND RESPONSE OBJECT
Program Coding:
Webform1.aspx
Program Coding:
Webform1.aspx
Webform1.aspx.vb
Public Class WebForm1
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim i As Integer
lblmessage1.Text = "<Table>"
For i = 0 To Request.Headers.Count - 1
lblmessage1.Text = lblmessage1.Text & "<TR><TD><B>" &
Request.Headers.GetKey(i) & "<B></TD><TD>" & Request.Headers(i) & "</TD></TR>"
Next
lblmessage1.Text = lblmessage1.Text & "</TABLE>"
End Sub
End Class
Output:
5. STUDENT DATABASE
Program Coding:
Webform1.aspx
&nbs
p; &nb
sp; &n
bsp; &
nbsp;
Student Information<br />
<br />
&nbs
p; &nb
sp; &n
bsp;
<asp:Label ID="Label1" runat="server" Text="Rollno"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br /><br />
&nbs
p; &nb
sp; &n
bsp;
<asp:Label ID="Label2" runat="server" Text="Name"></asp:Label>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<br /><br />
&nbs
p; &nb
sp; &n
bsp;
<asp:Label ID="Label3" runat="server" Text="Web"></asp:Label>
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
<br /><br />
&nbs
p; &nb
sp; &n
bsp;
<asp:Label ID="Label4" runat="server" Text="A/C"></asp:Label>
<asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
<br /><br />
&nbs
p; &nb
sp; &n
bsp;
<asp:Label ID="Label5" runat="server" Text="Cloud"></asp:Label>
<asp:TextBox ID="TextBox5" runat="server"></asp:TextBox><br />
<asp:Button ID="Button1" runat="server" Text="Submit" /><br />
&nbs
p; &nb
sp; &n
bsp;
<asp:Label ID="Label6" runat="server" Text="Total"></asp:Label>
<asp:TextBox ID="TextBox6" runat="server"></asp:TextBox>
<br /><br />
&nbs
p; &nb
sp; &n
bsp; &
nbsp;
<br />
&nbs
p; &nb
sp; &n
bsp; &
nbsp;
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="Rollno"
DataSourceID="SqlDataSource1" style="margin-left: 273px">
<Columns>
<asp:BoundField DataField="Rollno" HeaderText="Rollno" ReadOnly="True"
SortExpression="Rollno" />
<asp:BoundField DataField="SName" HeaderText="SName" SortExpression="SName" />
<asp:BoundField DataField="Webtechnology" HeaderText="Webtechnology"
SortExpression="Webtechnology" />
<asp:BoundField DataField="Accounts" HeaderText="Accounts" SortExpression="Accounts" />
<asp:BoundField DataField="Cloudcomputing" HeaderText="Cloudcomputing"
SortExpression="Cloudcomputing" />
<asp:BoundField DataField="Total" HeaderText="Total" SortExpression="Total" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$
ConnectionStrings:ConnectionString %>" ProviderName="<%$
ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand="SELECT * FROM
[std]"></asp:SqlDataSource>
</div></form></body></html>
Webform1.aspx.vb
Imports System.Data
Imports System.Data.OleDb
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim connectString As String = "Provider=Microsoft.jet.OLEDB.4.0;" & " Data Source=E:|Database
File|student.accdb"
Dim cn As OleDbConnection = New OleDbConnection(connectString)
cn.Open()
Dim selectString As String = "INSERT INTO std(Rollno,SName,Webtechnology,Accounts,Cloud) VALUES
('" & TextBox1.Text & "', '" & TextBox2.Text & "', '" & TextBox3.Text & "', '" & TextBox4.Text & "','" &
TextBox5.Text & "','" & TextBox6.Text & "')"
Dim cmd As OleDbCommand = New OleDbCommand(selectString, cn)
cmd.ExecuteNonQuery()
cn.Close()
End Sub
End Class
Output:
6. ONLINE BOOKSHOP
Program Coding:
Webform1.aspx
Advit.xml
Program Coding:
Webform1.aspx
Weform1.aspx.vb
Program Coding:
Webform1.aspx
Weform1.aspx.vb
Webform2.aspx
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="WebForm2.aspx.vb"
Inherits="ASP8.WebForm2" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
Welcome<br /><br /> <br /><br /><br />
The Window will expire in one minute</div>
</form></body></html>
Output:
9. COOKIES STATE MANAGEMENT
Program Coding:
Webform1.aspx
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="WebForm1.aspx.vb"
Inherits="ASP9.WebForm1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Create Cookie</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="lblwelcome" runat="server" Text="Welcome"></asp:Label>
<br />
<br />
&nbs
p;
<asp:Label ID="Name" runat="server" Text="Name"></asp:Label>
<asp:TextBox ID="txtname" runat="server"></asp:TextBox>
<br />
<br />
&nbs
p; &nb
sp;
<asp:Button ID="CreateCookie" runat="server" Text="Create Cookie" />
</div>
</form>
</body>
</html>
Webform1.aspx.vb
OUTPUT: