Web Tech
Web Tech
MADRAS UNIVERSITY
WEB TECHNOLOGY
LAB MANUAL
SI.NO. NAME OF THE PROGRAM PAGE NO.
SCRIPT PROGRAMS
Squares, Roots, Cubes & Complements of Integers Between
1
1 To 100
2 Simple Calculator
3 Sorting Numbers And Strings
4 Hit Counter
5 E-Mail Address Validation
6 Scrolling Text On Status Bar
7 Using Mutliple And Single Choice List
8 Digital Clock
9 Switching Images Using Mouse Events
10 Swapping Images
11 Using Frames Set Tags
12 Employee Database Validation
ASP PROGRAMS
13 Login Forms
14 Manipulation Of Employee Database
15 Usage Of Request And Response Object
16 Getting The Exact List of Headers Using Request Object
17 Manipulation Of Student Database
18 Online BookShop
19 Using OnMouseOver For a Hyperlink
20 Loading and Unloading a User Defined Page
21 Cookies
SCRIPT
PROGRAMS
AIM:
To write a simple HTML program for calculating Squares, Roots, Cubes, and
Components for an integer between 1 and 100 by writing “Javascript”.
ALGORITHM:
SOURCE CODE:
<html>
<meta http-equiv="x-ua-compatible"content="IE=10">
<head>
<title>MATH OPERATION</title></head>
<body>
<h2><b><center><u>Square root,Cube and Complement</h2></b></u></center>
<script language="Javascript">
var i,a=9,b=99,c=999,d;
i=prompt("enter the no between 1&100:");
document.write("<h3><centre><br/><br/>the square of"+i+"is="+(i*i));
document.write("<br/><br/>the square root of"+i+"is="+Math.sqrt(i));
document.write("<br/><br/>the cube of"+i+"is="+Math.pow(i,3));
if(i<=9)
{
document.write("<br/><br/>the 9's complement of"+i+"is="+(a-i));
d=parseInt((a-i)+1);
document.write("<br/><br/>the 10's complement of"+i+"is="+d);
}
else if((i>=10)&&(i<=99))
{
document.write("<br/><br/>the 9's complement of"+i+"is="+(b-i));
d=parseInt((b-i)+1);
document.write("<br/><br/>the 10's complement of"+i+"is="+d);
}
else if(i==100)
{
document.write("<br/><br/>the 9's complement of"+i+"is="+(c-i));
d=parseInt((c-i)+1);
document.write("<br/><br/>the 10's complement of"+i+"is="+d);
}
</script>
</body>
</html>
OUTPUT:
CONCLUSION:
Thus, the Java Script program for displaying Square, Roots, Cubes and Complements for
an Integer has been executed successfully.
EX.NO:2 SIMPLE CALCULATOR
AIM:
ALGORITHM:
SOURCE CODE:
<!--- SIMPLE CALCULATOR --->
<html>
<head> <title> Simple Calculator </title>
<style>
#b
{
width=60px;
height=30px;
}
</style>
<script language="Javascript">
var str,status=0;
function eql(form)
{
if(status==1)
{
str=calc.input.value;
x=str.split('pow');
calc.input.value=Math.pow(parseInt(x[0]),parseInt(x[1]));
}
else
calc.input.value=eval(calc.input.value);
}
function pl(form)
{
calc.input.value+='+';
status=0;
}
function min(form)
{
calc.input.value+='-';
status=0;
}
function mul(form)
{
calc.input.value+='*';
status=0;
}
function div1(form)
{
calc.input.value+='/';
status=0;
}
function clearing(form)
{
calc.input.value=' ';
}
function sin1(form)
{
calc.input.value=Math.sin(parseInt(calc.input.value));
}
function cos1(form)
{
calc.input.value=Math.cos(parseInt(calc.input.value));
}
function tan1(form)
{
calc.input.value=Math.tan(parseInt(calc.input.value));
}
function power(form)
{
calc.input.value+='pow';
status=1;
}
</script> </head>
<body bgcolor="pink">
<br/> <br/> <br/> <br/> <br/>
<font size="20">
<center> <h1>
Simple calculator
</center> </h1>
<center> <br/>
<form name="calc">
<table border="4">
<tr> <td>
<input type="text" name="input" size="38"/>
</tr> </td>
<tr> <td>
<input type="button"id="b"name="one"value="1"onClick="calc.input.value+='1'"/>
<input type="button"id="b"name="two"value="2"onClick="calc.input.value+='2'"/>
<input type="button"id="b"name="three"value="3"onClick="calc.input.value+='3'"/>
<input type="button"id="b"name="plus"value="+"onClick="pl(this.form);"/>
</tr></td>
<tr> <td>
<input type="button"id="b"name="four"value="4"onClick="calc.input.value+='4'"/>
<input type="button"id="b"name="five"value="5"onClick="calc.input.value+='5'"/>
<input type="button"id="b"name="six"value="6"onClick="calc.input.value+='6'"/>
<input type="button"id="b"name="minus"value="-" onClick="min(this.form);"/>
</td> </tr>
<tr> <td>
<input type="button"id="b"name="seven"value="7"onClick="calc.input.value+='7'"/>
<input type="button"id="b"name="eight"value="8"onClick="calc.input.value+='8'"/>
<input type="button"id="b"name="nine"value="9"onClick="calc.input.value+='9'"/>
<input type="button"id="b"name="multi"value="*"onClick="mul(this.form);"/>
</td> </tr>
<tr> <td>
<input type="button"id="b"name="clear"value="clr"onClick="clearing(this.form);"/>
<input type="button"id="b"name="equal"value="="onClick="eql(this.form);"/>
<input type="button"id="b"name="zero"value="0"onClick="calc.input.value+='0' "/>
<input type="button"id="b"name="div"value="/"onClick="div1(this.form);"/>
</tr> </td>
<tr> <td>
<input type="button"id="b"name="sin"value="sin"onClick="sin1(this.form);"/>
<input type="button"id="b"name="cos"value="cos"onClick="cos1(this.form);"/>
<input type="button"id="b"name="tan"value="tan"onClick="tan1(this.form);"/>
<input type="button"id="b"name="pow"value="pow"onClick="power(this.form);"/>
</td> </tr>
</table>
</center>
</font>
</form>
</body>
</html>
OUTPUT:
SIMPLE CALCULATOR
RESULT:
Thus the Simple Calculator program in JavaScript has been generated and executed
successfully.
EX:NO:3 SORTING NUMBERS AND STRINGS
AIM:
To write a simple HTML program for SORTING numbers and strings using arrays in “Javascript”.
ALGORITHM:
SOURCE CODE:
<html>
<meta http-equiv="x-ua-compatible"content="IE=10">
<head>
<title> Sorting Array Elements
</title> </head>
<body>
<script language="javascript">
var n,i,j,temp,m;
arr=new Array(15);
brr=new Array(15);
n=prompt("Enter the value of n","n");
for(i=0;i<n;i++)
arr[i]=parseInt(prompt("enter the integer"));
for(j=0;j<n;j++)
brr[j]=prompt("enter the string");
//numbers sorting
//string sorting
document.write("<u><h1> Sorting Strings</h1><br/> <h3> Before sorting </h3></u>");
for(j=0;j<n;j++)
document.write("<h4>"+brr[j]+"</h4>");
document.write("<b><h3>Sorted using sort() method </b></h3>");
brr.sort();
document.write("<b><u><h3>After sorting</b></u></h3>");
for(j=0;j<n;j++)
document.write("<h4><br/>"+brr[j]+"</h4>");
</script> </body> </html>
OUTPUT:
AIM:
To create a simple html program to generate hit counter by using “JavaScript”.
ALGORITHM:
SOURCE CODE:
//HIT COUNTER USING JAVASCRIPT
<html>
<head>
<script language="javascript">
<!--
function nameDefined(ckie,nme)
{
var splitValues;
var i;
for(i=0;i<ckie.length;++i)
{
splitValues=ckie[i].split("=");
if(splitValues[0]==nme)
return true;
}
return false;
}
function delBlanks(strng)
{
var result="";
var i;
var chrn;
for(i=0;i<strng.length;++i)
{
chrn=strng.charAt(i);
if(chrn!=" ")
result +=chrn;
}
return result;
}
function getCookieValue(ckie,nme)
{
var splitValues;
var i;
for(i=0;i<ckie.length;++i)
{
splitValues=ckie[i].split("=");
if(splitValues[0]==nme)
return splitValues[1];
}
return "";
}
function insertcounter()
{
readcookie();
displaycounter();
}
function displaycounter()
{
document.write('<h3 ALIGN="CENTER">');
document.write("You have Visited this page");
if(counter==1)
document.write(" The First Time.");
else
document.write(counter += " TIMES.");
document.write('</h3>');
}
function readcookie()
{
var cookie=document.cookie;
counter=0;
var chkdCookie=delBlanks(cookie);
var nvpair=chkdCookie.split(";");
if(nameDefined(nvpair,"pageCount"))
{
counter=parseInt(getCookieValue(nvpair,"pageCount"));
}
++counter;
var futdate=new Date();
var expdate=futdate.getTime();
expdate+=3600000*24*30;
futdate.setTime(expdate);
var newCookie="pageCount = "+counter;
newCookie+= "; expires="+futdate.toGMTString();
window.document.cookie=newCookie;
}
//-->
</script>
</head>
<body>
<script language="javascript">
<!--
insertcounter();
//-->
</script>
</body>
</html>
OUTPUT:
HIT COUNTER
RESULT:
Thus, the hit counter program in JavaScript has been generated and executed
successfully.
EX:NO:5 EMAIL ADDRESS VALIDATION
AIM:
To create a simple HTML program for validating the Email ID by the user.
ALGORITHM:
Step 3-1: get the email ID from the user using prompt tag and store it in str variable
Step 4:split the str string into two parts with @ by writing split function: first part will be stored
in user[0],second part will be stored in user[1]
Step 4-1: In chk state, check whether the first part user [0] has all its characters as numbers or
alphabets or underscore, using unicode values in for loops
Step 4-2: If true for all characters assign state=1, else state=0 break the chk state
Step 4-4: print “valid email ID" else print “Invalid email ID"
SOURCE CODE:
<!--EmailID Validation-->
<html>
<meta http-equiv="x-ua-compatible"content="IE=10">
<head>
<title>
Email-id validation</title>
<script language="Javascript">
function check()
{
var str;
var state=0;
var state1=0;
str=prompt("Enter ur E-mail ID");
document.write("<h1><b><center>E-mail ID Validation</center></b></h1>");
document.write("<b><center>E-mail Id:"+str+"</b></center>");
var user=str.split("@");
chkstate:
for(i=0;i<user[0].length;i++)
{
if((user[0].charCodeAt(i)>96 && user[0].charCodeAt(i)<123)
||(user[0].charCodeAt(i)>64 && user[0].charCodeAt(i)<91)
||(user[0].charCodeAt(i)>47 && user[0].charCodeAt(i)<58)
||(user[0].charCodeAt(i)==95 ))
state=1;
else
{
state=0;
break chkstate;
}
}
chkstate1:
for(i=0;i<user[1].length;i++)
{
if((user[1].charCodeAt(i)>96 && user[1].charCodeAt(i)<123)
||(user[1].charCodeAt(i)>64 && user[1].charCodeAt(i)<91)
||(user[1].charCodeAt(i)>47 && user[1].charCodeAt(i)<58)
||(user[1].charCodeAt(i)==64 )||(user[1].charCodeAt(i)==46))
state1=1;
else
{
state1=0;
break chkstate1;
}
}
if(state==1 && state1==1)
{
var domain=user[1].split(".");
if(domain[1].length==0||domain[1].length>4)
alert("Invalid Email Id");
else
alert("valid Email Id");
}
else
alert("Invalid Email Id"); }
</script> </head>
<body onLoad="check()">
</body> </html>
OUTPUT:
E-Mail ID Validation
RESULT:
Thus, the Email ID using java script has been generated and executed successfully.
EX:NO:6 SCROLLING TEXT ON STATUS BAR
AIM:
To write a simple html program for scrolling text in the statusbar of the web page using
“JavaScript”.
ALGORITHM:
SOURCE CODE:
<!--SCROLLING TEXT ON STATUS BAR-->
<html>
<head>
<style>
.text
{
font:14 pt arial;
color:red;
}
</style>
<script language="javascript">
barmsg="welcome to my page";
i=0;
function scrollmsg()
{
beginningpart=barmsg.substr(i,barmsg.length);
endpart=barmsg.substr(0,i);
window.status=beginningpart+endpart;
if(i<barmsg.length)
{
i++;
}
else
{
i=0;
}
setTimeout("scrollmsg()",300)
}
</script>
</head>
<body onLoad="scrollmsg()" bgcolor="pink">
<br><br><br> <center>
<font class=text> <h1> <u>scrolling text in status bar</u> </h1> <br>
<h3>Look at the Status Bar in the botton left of your webpage.....</h3>
</center>
</body>
</html>
OUTPUT:
RESULT:
Thus, the program for Scrolling Text in the Statusbar using JavaScript has been executed
successfully.
EX:NO:7 MULTIPLE, SINGLE CHOICE LIST
AIM:
To write a html program for a form that consists of multiple choice list and single choice list
using VBscript.
ALGORITHM:
SOURCE CODE:
<head>
<meta http-equiv="x-ua-compatible" content="IE=10">
<script language="vbscript">
dim i,tot
tot=0
sub maindish()
i=f1.s1.selectedIndex
for i=0 to 3
if f1.s1.options(i).selected then
f1.ta1.value=f1.ta1.value+vbcrlf+f1.s1.options(i).text
tot=tot+cint(right(f1.s1.options(i).value,3))
end if
next
end sub
sub starters()
i=f1.s2.selectedIndex
f1.ta1.value=f1.ta1.value+vbtab+f1.s2.options(i).text
end sub
sub milkshake()
i=f1.s3.selectedIndex
f1.ta1.value=f1.ta1.value+vbtab+f1.s3.options(i).text
end sub
sub bill()
msgbox"you have to pay:is" &Cstr(tot)
end sub
</script>
</head>
<body>
<form name="f1">
<br> <br> <br>
<center> <b> <br> <u>SAMPLE MENUCARD</u> </b> </center> <br> <br>
<input type="label" name="label1" value="maindish" >
<select name="s1" onChange="maindish()" MULTIPLE >
<option value="mcburger->100"> mcburger </option>
<option value="fishfillets->120"> fishfillets </option>
<option value="chickenburger->140"> chickenburger </option>
<option value="vegburger->130"> vegburger </option>
</select> <br> <br>
<input type="label" name="label2" value="starters">
<select name="s2" onChange="starters()">
<option> frenchfries </option>
<option> nuggets </option>
<option> hashbrowns </option>
<option> mcalooticks </option>
</select> <br> <br>
<input type="label" name="label3" value="misc">
<select name="s3" onChange="milkshake()">
<option> milkshake </option>
<option> softdrinks </option>
<option> softy </option>
<option> cooldrinks </option>
</select> <br> <br>
<textarea name="ta1" rows="10" cols="50">
</textarea> <br> <br> <br>
<input type="button" name="button1" value="bill" onClick="bill()">
</form>
</body>
</html>
OUTPUT:
Thus, the choice list program in the VBscript has been created and generated
successfully.
EX:NO:8 DIGITAL CLOCK
AIM:
To write a simple HTML program using VBscript for displaying a digital clock in
webpage.
ALGORITHM:
SOURCE CODE:
<!-- Digital Clock using Javascript-->
<html>
<head>
<script language="Javascript">
function startTime()
{
var today=new Date();
var h=today.getHours();
var m=today.getMinutes();
var s=today.getSeconds();
ap=checkAmPm(h);
m=checkTime(m);
s=checkTime(s);
document.getElementById('txt').innerHTML="<center><h3>"
+h+":"+m+":"+s+":"+ap+"</center></h3>";
t=setTimeout('startTime()',1000);
}
function checkTime(i)
{
if(i<10)
i="0"+i;
return i
}
function checkAmPm(i)
{
if(i>=12)
i="Pm";
else
i="Am";
return i
}
</script>
</head>
<body onLoad="startTime()"bgcolor="yellow">
<br/><br/>
<center><h1>Digital Clock</h1></center>
<br/>
<center><div id="txt"></div>
</center>
</body>
</html>
OUTPUT:
SOURCE CODE:
<!-- Digital Clock using VBscript-->
<html>
<meta http-equiv="x-ua-compatible"content="IE=10">
<head>
<script language="vbscript">
dim dt
dim h,m,s,h1,m1,s1
function digital( )
dt=time
h=hour(dt)
m=minute(dt)
s=second(dt)
if (h<10) then
h1="0"&cstr(h)
else
h1=cstr(h)
end if
if (m<10) then
m1="0"&cstr(m)
else
m1=cstr(m)
end if
if (s<10) then
s1="0"&cstr(s)
else
s1=cstr(s)
end if
if (h<12) then
s1=s1+"AM"
else
s1=s1+"PM"
end if
document.getElementById("label1").Innertext=cstr(h1)&":"&cstr(m1)&":"&cstr(s1)
setTimeout"digital( )",1000
end function
</script>
</head>
<body onLoad="digital( )"bgcolor="pink">
<b><br><center><u>Digital Clock</u></b><br><br><br><br>
<input type="label" id="label1" value="WELCOME"></center>
</body>
</html>
OUTPUT:
RESULT:
Thus the Digital Clock program in VBscript has been generated and executed
successfully.
EX:NO:9 SWITCHING IMAGES USING MOUSE EVENTS
AIM:
To write a simple HTML program to design a webpage for switching between three images using
VBscript
ALGORITHM:
SOURCE CODE:
<----SWTICHING IMAGES---->
<html>
<head> <title> SWITCHING IMAGES </title>
<meta http-equiv="x-ua-compatible" content="IE=10">
<script language="vbscript">
function Btn1()
document.img1.src="e:\faranaa\pic1.JPG"
end function
function Btn2()
document.img1.src="e:\faranaa\pic2.BMP"
end function
function Btn3()
document.img1.src="e:\faranaa\pic3.BMP"
end function
</script>
</head>
<body> <center> <br> <br> <br> <u> <h1> SWITCHING IMAGES </h1> </u> </b>
<img src="pic4.JPG" name="img1" height=300 width=300> <br> <br>
<input type="button" name="button1" value="flower" onClick="Btn1()">
<input type="button" name="button2" value="tower" onClick="Btn2()">
<input type="button" name="button3" value="beach" onClick="Btn3()">
</center>
</body>
</html>
OUTPUT:
SWICHING IMAGES
RESULT:
Thus, the Switching Images program using VBScript has been generated and executed
successfully.
EX:NO:10 SWAPPING IMAGES
AIM:
To write a simple HTML program for swapping two images in the onmouseOver, onmouseOut,
on, ondoubleclick as event using VBscript.
ALGORITHM:
SOURCE CODE:
<html>
<head><meta http-equiv="x-ua-compatible" content="IE=10">
<title>using onMouseOver,onMouseEvent,onDoubleClientEvent</title>
<script language="vbscript">
function imgSwitchOn()
document.img1.src="D:\divitha\bird.jpg"
document.img2.src="D:\divitha\rose.jpg"
end function
function imgSwitchOff()
document.img1.src="D:\divitha\rose.jpg"
document.img2.src="D:\divitha\bird.jpg"
end function
function content()
document.write("<h4> Image1 <br> Filename:Colour Images <br> type:jpg Image <br> </h4> <h4>
Image2 <br> Filename:Color Image <br> type:jpg Image</h4>")
end function
</script>
</head>
<body> <center> <h2> <u>swapping images using onMouseOver,onMouseEvent,onDoubleClickEvent
</u> </h2> <br>
<h2> <i> <b> place your mouse pointer on the picture </b> </i> </h2>
<a onMouseOver="imgSwitchOn()" onMouseOut="imgSwitchOff()">
<img alt="bird" height="170" width="170" name="img1"src="bird.jpg"></a>
<a onMouseOver="imgSwitchOn()" onMouseOut="imgSwitchOff()">
<img Alt="rose" height="170" width="170" name="img2" src="rose.jpg"></a>
<br><br><br>
<input type="button" id="b1" value="double click here to view image details" ondblClick="content()">
</center>
</body>
</html>
OUTPUT:
SWAPPING IMAGES
RESULT:
Thus, the Swapping Image program in VBScript has been generated and executed
successfully.
EX:NO:11 USING FRAMES SET TAGS
AIM:
To write a HTML program to design a webpage with frameset with two frames side by side using
VBscript.
ALGORITHM:
SOURCE CODE:
<!--Main.html-->
<html>
<frameset cols="50%,*">
<frame src="first.html" name="first">
<frame src="second.html" name="second">
</frameset>
</html>
<!--first.html-->
<html>
<script language="vbscript">
sub radioclk1()
top.second.document.location.href="D:\wt\yahoo.html"
end sub
sub radioclk2()
top.second.document.location.href="D:\wt\infoseek.html"
end sub
sub radioclk3()
top.second.document.location.href="D:\wt\altavista.html"
end sub
</script>
<body bgcolor="pink">
<font face="Times New Roman" size="6"><u><center>
Select A Web Page </u></center></font>
<font face="Times New Roman" size="5"> <br><br>
<input type="radio" name="r1" text="Yahoo" onclick="radioclk1()">
Yahoo <br><br>
<input type="radio" name="r1" text="Infoseek" onclick="radioclk2()">
Infoseek <br><br>
<input type="radio" name="r1" text="Altavista" onclick="radioclk3()">
Altavista <br><br>
</font>
</body>
</html>
<!--second.html-->
<html>
<body bgcolor="aqua">
<font face="Times New Roman" size="6">
<u><center>WEB PAGE</center></u>
</font> </body> <html>
<!--infoseek.html-->
<html>
<body bgcolor="aqua">
<font face="Times New Roman" size="7"><u><center>
Welcome to Infoseek Web Page </u></center></font>
<font face="Times New Roman" size="5">
<br>
<ol>
<li> Infoseek was a very popular search engine founded in
1994 by Steve Kirsch.
<li>Infoseek was originally operated by
Infoseek corparation,headquarted in sunnyvale,california.
<li>Infoseek featured a very complex system of search modifiers,
including boolean modifiers such as the most basic "OR"and
"NOT",parentheses and quotes upto being able to say that
one wanted one word or phrase,to appear within X number
of words from another word or phrase
</ol>
</font> </body> </html>
<!--altavista.html-->
<html>
<body bgcolor="aqua" >
<font face="Times New Roman" size="7"><u><center>
Welcome to Altavista Web Page </u></center></font>
<font face="Times New Roman" size="5">
<br>
<ul>
<li> Altavista is a web search engine owned by Yahoo!
Altavista was once one of the most popular search
engines but its popularity declined with rise of Google.
<li>Yahoo plans on discontinouing Altavista,as it is underperforming
Altavista was created by researches at Digital equipment
corporations Western Research Labrotary who were trying
to make finding files on public network easier.
<li>Altavista was publicly launched as an Internet search engine
on 15 Dec 1995 at Altavista.digital.com.
</ul>
</font> </body> </html>
<!--yahoo.html-->
<html>
<body bgcolor="aqua">
<font face="Times New Roman" size="7"><u><center>
Welcome to Yahoo Web Page </u></center></font>
<font face="Times New Roman" size="5">
<br>
   Yahoo is an American public
corporation with headquaters in
sunnyvale,california,that provide services via internet worldwide.
Yahoo was founded by Jerry Yang and David Filo in Jan1994
and was incorparated on Mar1 1995.
<br>    The
company is perhaps best known for its web portal,
search engine(Yahoo search),Yahoo! Directory,Yahoo Mail,
Yahoo! News,advertising,Online mapping(Yahoo! maps),
video sharing(Yahoo! video) and social media websites and services.
</font> </body> </html>
OUTPUT:
AIM:
To write a simple HTML program to design a webpage for calculating ‘Paybill’ using employee
database and VBscript.
ALGORITHM:
SOURCE CODE:
<html>
<head>
<meta http-equiv="x-ua-compatible" content="IE=10">
<script language="vbscript">
Const adLockOptimistic=3
Const adUseClient=3
dim i,id,ch
dim objconn,objrs,strsql
set objconn=CreateObject("ADODB.Connection")
set objrs=CreateObject("ADODB.Recordset")
objconn.Open"provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\Anusuya.A\employee1.mdb;"
strsql="select * from emp"
sub designation()
i=EmpForm.d1.selectedIndex
EmpForm.Text21.value=EmpForm.d1.options(i).Text
select Case i
Case 0:EmpForm.Text3.value=20000
EmpForm.Text4.value=Cint(EmpForm.Text3.value)*20/100
EmpForm.Text5.value=Cint(EmpForm.Text3.value)*15/100
Case 1:EmpForm.Text3.value=15000
EmpForm.Text4.value=Cint(EmpForm.Text3.value)*10/100
EmpForm.Text5.value=Cint(EmpForm.Text3.value)*8/100
Case 2:EmpForm.Text3.value=10000
EmpForm.Text4.value=Cint(EmpForm.text3.value)*5/100
EmpForm.Text5.value=Cint(EmpForm.text3.value)*2/100
End select
End sub
Sub save()
objrs.Fields(0)=Cint(EmpForm.Text1.value)
objrs.Fields(1)=EmpForm.Text2.value
objrs.Fields(2)=EmpForm.Text21.value
objrs.Fields(3)=Cint(EmpForm.Text3.value)
objrs.Fields(4)=Cint(EmpForm.Text4.value)
objrs.Fields(5)=Cint(EmpForm.Text5.value)
objrs.Fields(6)=Cint(EmpForm.Text6.value)
objrs.Fields(7)=Cint(EmpForm.Text7.value)
End sub
Sub display()
msgbox "display"
EmpForm.Text1.value=objrs.Fields(0)
EmpForm.Text2.value=objrs.Fields(1)
EmpForm.Text21.value=objrs.Fields(2)
EmpForm.Text3.value=objrs.Fields(3)
EmpForm.Text4.value=objrs.Fields(4)
EmpForm.Text5.value=objrs.Fields(5)
EmpForm.Text6.value=objrs.Fields(6)
EmpForm.Text7.value=objrs.Fields(7)
End sub
Sub search()
id=InputBox("Enter the Employee id to search")
objrs.Open"select * from emp where Eno=" & Cint(id),objconn,adOpenStatic,adLockOptimistic
msgbox"Search"
if objrs.bof or objrs.eof then
msgbox "NO RECORD"
objrs.close
exit sub
End if
display()
objrs.Close
End sub
sub cl()
EmpForm.Text1.value=" "
EmpForm.Text2.value=" "
EmpForm.Text21.value="Manager"
EmpForm.Text3.value=" "
EmpForm.Text4.value=" "
EmpForm.Text5.value=" "
EmpForm.Text6.value=" "
EmpForm.Text7.value=" "
End sub
sub newrec()
msgbox "Add"
objrs.Open"select * from emp",objconn,adOpenStatic,adLockOptimistic
objrs.AddNew()
save()
objrs.Update
MsgBox "Record is Added"
objrs.Close
End sub
sub process()
EmpForm.Text6.value=Cint(EmpForm.Text3.value)+Cint(EmpForm.Text4.value)
EmpForm.Text7.value=Cint(EmpForm.Text6.value)-Cint(EmpForm.Text5.value)
End sub
sub confirms()
Msgbox "Update"
objrs.Open"select * from emp where
Eno="&Cint(EmpForm.text1.value),objconn,adOpenStatic,adLockOptimistic
save()
objrs.Update
MsgBox"Record Updated"
objrs.Close
end sub
sub del()
objrs.Open "delete from emp where Eno="
&Cint(EmpForm.Text1.value),objconn,adOpenStatic,adLockOptimistic
cl()
MsgBox "Record Deleted"
objrs.Close
end sub
sub navi()
objrs.Open"select * from emp",objconn,adOpenStatic,adLockOptimistic
if objrs.BOF or objrs.EOF Then
MsgBox"Empty Table"
exit sub
end if
objrs.MoveFirst
</script>
</head>
<body>
<form name="EmpForm">
<b> <u> <center> Employee PayRoll Preparation </center> </b> </u>
<br> <br>
Emp Id:<input type="TextBox" Name="Text1" value="0">
<br> <br>
EmpName:<input type="TextBox" name="Text2" value="Name">
Designation:<input type="TextBox" name="Text21" value="design">
<select Name="d1" onChange="designation()">
<option> Manager </option>
<option> Asst.Manager </option>
<option> Accountant </option>
</select> <br> <br>
Basic pay:<input type="TextBox" Name="Text3" value="0">
<br> <br>
Allowance:<input type="TextBox" name="Text4" value="0">
<br> <br>
Deduction:<input type="TextBox" name="Text5" value="0">
<br> <br>
Gross Pay:<input type="TextBox" name="Text6" value="0">
<br> <br>
Net Pay:<input type="TextBox" name="Text7" value="0">
<br> <br>
<input type="button" name=button1" value="clear form" onClick="cl()">
<br> <br>
<input type="button" name=button2" value="calculate pay" onClick="process()">
<br> <br>
<input type="button" name=button7" value="search" onClick="search()">
<br> <br>
<input type="button" name=button3" value="save record" onClick="newrec()">
<br> <br>
<input type="button" name=button4" value="Edit and update" onClick="confirms()">
<br> <br>
<input type="button" name=button5" value="Delete" onClick="del()">
<br> <br>
<input type="button" name=button6" value="Next" onClick="navi()">
<br> <br>
</form>
</body>
</html>
OUTPUT:
AIM:
To design an Asp.net application that will have a login form and make it expire after 10000
milliseconds.
ALGORITHM:
SOURCE CODE:
<!-----Login Form
<!-----login1.aspx
<%@ Page Language="vb" AutoEventWireup="false"
CodeBehind="login1.aspx.vb" Inherits="WebApplication1._Default" %>
<!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>Untitled Page</title>
<script type="text/javascript">
function upchk()
{
var d=setTimeout("alert('your session expired!!!')+self.close()",10000);
}
</script>
</head>
<body onload="upchk()">
<form id="form1" runat="server">
<div>
<asp:Login ID="Login1" runat="server">
</asp:Login>
</div>
</form>
</body>
</html>
<------login2.aspx
<%@ Page Language="vb" AutoEventWireup="false"
CodeBehind="login2.aspx.vb" Inherits="WebApplication1.login2" %>
<!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>Untitled Page</title>
</head>
<body>
<p>
WELCOME TO THE WEBPAGE</p>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
<-----login1.aspx.vb
LOGIN FORMS
RESULT:
Thus, the login page in ASP.NET application has been designed and executed
successfully.
EX:NO:14 MANIPULATION OF EMPLOYEE DATABASE
AIM:
To design an Asp.net application for creating an employee database and manipulate the records
using the commands in Asp.net
ALGORITHM:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:Label ID="Label1" runat="server" Text="Emp Name"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server" Width="102px"></asp:TextBox>
&n
bsp;  
; &n
bsp;  
; &n
bsp;  
; &n
bsp;
<asp:Button ID="Button1" runat="server" Text="Add" Height="30px" Width="58px" />
<p>
<asp:Label ID="Label2" runat="server" Text="Emp id"></asp:Label>
&n
bsp;
<asp:TextBox ID="TextBox2" runat="server" Width="104px"></asp:TextBox>
&n
bsp;  
; &n
bsp;  
; &n
bsp;  
; &n
bsp;
<asp:Button ID="Button2" runat="server" Text="Update" Height="26px" Width="57px" />
</p>
<asp:Label ID="Label3" runat="server" Text="Designation"></asp:Label>
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem>Manager</asp:ListItem>
<asp:ListItem>Asst Manager</asp:ListItem>
<asp:ListItem>Employee</asp:ListItem>
</asp:DropDownList>
&n
bsp;  
; &n
bsp;  
; &n
bsp;  
; &n
bsp;
<asp:Button ID="Button3" runat="server" Text="Delete" Height="30px"
Width="60px" />
<br />
<br />
<asp:Label ID="Label4" runat="server" Text="Basic Pay"></asp:Label>
<asp:TextBox ID="TextBox3" runat="server" Width="105px"></asp:TextBox>
&n
bsp;  
; &n
bsp;  
; &n
bsp;  
; &n
bsp;
<asp:Button ID="Button4" runat="server" Text="Search" />
<br />
<asp:Label ID="Label5" runat="server" Text="Allowance"></asp:Label>
<asp:TextBox ID="TextBox4" runat="server" Width="106px"></asp:TextBox>
&n
bsp;  
; &n
bsp;  
; &n
bsp;  
; &n
bsp;
<asp:Button ID="Button5" runat="server" Text="Clear" Height="30px"
style="margin-top: 26px" Width="60px" />
<br />
<br />
<asp:Label ID="Label6" runat="server" Text="Deduction"></asp:Label>
<asp:TextBox ID="TextBox5" runat="server" Width="104px"></asp:TextBox>
<br />
<br />
<asp:Label ID="Label7" runat="server" Text="Gross Pay"></asp:Label>
<asp:TextBox ID="TextBox6" runat="server" Width="104px"></asp:TextBox>
<br />
<br />
<asp:Label ID="Label8" runat="server" Text="Net Pay"></asp:Label>
<asp:TextBox ID="TextBox7" runat="server" Width="102px"></asp:TextBox>
<br />
<br />
<br />
<asp:DataGrid ID="DataGrid1" runat="server" BackColor="White"
BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px" CellPadding="3"
GridLines="Horizontal">
<FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
<SelectedItemStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
<PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right"
Mode="NumericPages" />
<AlternatingItemStyle BackColor="#F7F7F7" />
<ItemStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
<HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
</asp:DataGrid>
<br />
<asp:SqlDataSource ID="SqlDataSource1" runat="server"></asp:SqlDataSource>
</form>
</body>
</html>
Default.aspx.vb
Imports System.Data
Imports System.Data.OleDb
Partial Class _Default
Inherits System.Web.UI.Page
Dim cn1 As New OleDbConnection
Dim cn As New
OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;DataSource=F:\Anu\Employee\emp.mdb")
Dim cmd As New OleDbCommand
Dim dbadp As New OleDbDataAdapter
Dim dbset As New DataSet
Dim n As Integer
Dim no As Integer
End Sub
End Class
OUTPUT:
EMPLOYEE DATABASE
RESULT:
Thus the application in Asp.net for manipulation of employee database has been created and
executed successfully
EX:NO:15 USAGE OF REQUEST AND RESPONSE OBJECT
AIM:
To design a Asp.net application for the usage of request and response object.
ALGORITHM:
SOURCE CODE:
Default.aspx:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<p>
&n
bsp; &nbs
p;
&n
bsp; &nbs
p;
</p>
<p>
&n
bsp; &nbs
p;
&n
bsp; &nbs
p;
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</p>
<p>
&n
bsp; &nbs
p;
&n
bsp; &nbs
p;
<asp:Button ID="Button1" runat="server" Text="Browser" />
</p>
<p>
&n
bsp; &nbs
p;
&n
bsp; &nbs
p;
<asp:Button ID="Button2" runat="server" Text="Home" Width="66px" />
</p>
</form>
<p>
&n
bsp;
</p>
</body>
</html>
Default.aspx.vb
Default2.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<p>
&n
bsp; &nbs
p;
&n
bsp; &nbs
p;
</p>
<p>
</p>
<p>
&n
bsp; &nbs
p;
WELCOME TO REDIRECT AND OBJECT PAGE</p>
<p>
&n
bsp; &nbs
p;
&n
bsp; &nbs
p;
<asp:Button ID="Button1" runat="server" Text="Server" Width="63px" />
</p>
<p>
&n
bsp; &nbs
p;
&n
bsp; &nbs
p;
<asp:Button ID="Button2" runat="server" Height="24px" Text="Home"
Width="66px" />
</p>
<p>
</p>
<p>
</p>
</form>
</body>
</html>
Default2.aspx.vb
Next
End Sub
Request.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<p>
&n
bsp; &nbs
p;
&n
bsp; USA
GE
OF
REQUEST AND RESPONSE OBJECT</p>
<p>
&n
bsp; &nbs
p;
&n
bsp; &nbs
p;
<asp:Button ID="Button1" runat="server" Text="WRITE" />
<asp:Button ID="Button2" runat="server" Text="WRITEFILE" />
</p>
<p>
&n
bsp; &nbs
p;
&n
bsp; &nbs
p;
<asp:Button ID="Button3" runat="server" Text="REDIRECT" />
<asp:Button ID="Button4" runat="server" Text="REQUEST" />
</p>
</form>
</body>
</html>
Request.aspx.vb
OUTPUT
Thus the Asp.net Application for the usage of request and response object has been created and
executed successfully.
EX:NO:16 GETTING THE EXACT LIST OF HEADER USING REQUEST OBJECT
AIM:
To design an asp.net application which gives the list of header using request object.
ALGORITHM:
OUTPUT:
HEADER OBJECT
RESULT:
Thus, the application in ASP.NET using header file has been designed and execute
successfully.
EX:NO:17 MANIPULATIONOF STUDENT DATABASE
AIM:
To design an Asp.net application for the manipulation of student database.
ALGORITHM:
SOURCE CODE:
< -----Default.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
&n
bsp; &nbs
p;
&n
bsp; &nbs
p;
<asp:Label ID="Label1" runat="server" Text="STUDENT DATABASE"></asp:Label>
<br />
<br />
<asp:Label ID="Label2" runat="server" Text="REG NO"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" style="height: 26px" Text="UPDATE" />
<asp:Button ID="Button2" runat="server" Text="DELETE" />
<asp:Button ID="Button3" runat="server" Text="ADD" />
<asp:Button ID="Button4" runat="server" Text="CLEAR" />
<asp:Button ID="Button5" runat="server" style="height: 26px" Text="SEARCH" />
<asp:Button ID="Button6" runat="server" Text="PROCESS" />
<br />
<br />
<asp:Label ID="Label3" runat="server" Text="NAME"></asp:Label>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<br />
<br />
<asp:Label ID="Label4" runat="server" Text="M1"></asp:Label>
&n
bsp;
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
&n
bsp;
<br />
<br />
<asp:Label ID="Label5" runat="server" Text=" M2"></asp:Label>
&n
bsp;
<asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
&n
bsp;
<br />
<br />
<asp:Label ID="Label6" runat="server" Text="M3"></asp:Label>
&n
bsp;
<asp:TextBox ID="TextBox5" runat="server"></asp:TextBox>
<br />
<br />
<asp:Label ID="Label7" runat="server" Text="TOTAL"></asp:Label>
<asp:TextBox ID="TextBox6" runat="server"></asp:TextBox>
<br />
<br />
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:aspstudentConnectionString2 %>"
ProviderName="<%$ ConnectionStrings:aspstudentConnectionString2.ProviderName %>"
SelectCommand="SELECT * FROM [aspstud]"></asp:SqlDataSource>
<asp:DataGrid ID="DataGrid1" runat="server" DataSourceID="SqlDataSource1">
</asp:DataGrid>
<br />
<br />
<br />
<br />
<br />
<br />
</form>
</body>
</html>
Default.aspx.vb
Imports System.Data
Imports System.Data.OleDb
Partial Class _default
Inherits System.Web.UI.Page
Dim cn1 As New OleDbConnection
Dim cn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=E:\kar3bca\student\aspstudent.mdb")
Dim cmd As New OleDbCommand
Dim dbset As New DataSet
Dim dbadp As New OleDbDataAdapter
Dim regno As Integer
Dim n As Integer
Dim name As String
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
STUDENT DATABASE
RESULT:
Thus, the Student database is manipulated using ASP.NET application and it has been
designed and executed successfully.
EX:NO:18 ONLINE BOOKSHOP
AIM:
ALGORITHM:
SOURCE CODE:
Default.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<p style="font-size: large; font-weight: 700; text-align: center">
ONLINE BOOK SHOP</p>
<p style="text-align: center">
<asp:AdRotator ID="AdRotator1" runat="server"
AdvertisementFile="~/XMLFile.xml" />
</p>
</form>
</body>
</html>
Default2.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div style="text-align: center; font-size: large; font-weight: 700">
Default3.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div style="text-align: center; font-size: large; font-weight: 700">
Default4.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
WELCOME TO CTTE</form>
</body>
</html>
XML FILE:
OUTPUT:
ONLINE BOOKSHOP
RESULT:
Thus, the ASP.NET application that describes books in Online Book Shop has been
designed and executed successfully.
EX:NO:19 USING ONMOUSEOVER FOR HYPERLINK
AIM:
To design an Asp.net application that will navigate the new page when the mouse is over
in Hyperlink.
ALGORITHM:
SOURCE CODE:
Default.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<p>
<br />
</p>
<p>
</p>
<p style="height: 28px; width: 434px; margin-left: 400px">
USING MOUSEOVER FOR A HYPERLINK</p>
<p style="height: 40px; width: 615px; font-family: 'Times New Roman', Times, serif; font-size: xx-
large; margin-left: 320px">
C.T.T.E COLLEGE FOR WOMEN</p>
<p style="height: 24px; width: 488px; font-family: 'Times New Roman', Times, serif; font-size:
medium; margin-left: 380px">
Move the mouse over the Hyperlink to view the details</p>
<form id="form1" runat="server">
<div style="height: 21px; width: 321px; margin-left: 444px;">
</div>
<p style="height: 25px; width: 355px; margin-left: 422px">
<asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl="default3.aspx">EXTRA
CURRICULAR ACTIVITIES</asp:HyperLink>
</p>
<p>
</p>
<p>
</p>
</form>
</body>
</html>
Default.aspx.vb
Default2.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<style type="text/css">
.style1
{
font-size: large;
font-weight: bold;
}
</style>
</head>
<body>
<p>
<br />
</p>
<p>
</p>
<p class="style1">
CTTE COLLEGE FOR WOMEN</p>
<p>
DEPARTMENTS AVAILABLE:</p>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
Default3.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<style type="text/css">
.style1
{
font-size: large;
font-weight: bold;
}
</style>
</head>
<body>
<p>
<br />
</p>
<p>
</p>
<p>
</p>
<p class="style1">
CTTE COLLEGE FOR WOMEN</p>
<p class="style1">
EXTRA CURRICULAR ACTIVITIES:</p>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
OUTPUT:
Thus, an ASP.NET application using mouseover event for Hyperlink has been designed
and executed successfully.
EX:NO:20 LOADING AND UNLOADING A USER DEFINED PAGE
AIM:
To design an asp.net application for using loading and unloading a user defined page.
ALGORITHM:
SOURCE CODE
Default.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<script type="text/javascript">
function click1()
{
alert("HAI")
var d=open("default2.aspx","_blank","menubar=no,resizeable=yes,toolbar=no,status=no,address=no")
}
function click2()
{
self.close()
}
</script>
<style type="text/css">
.style1
{
text-align: center;
}
#Button2
{
margin-left: 421px;
}
#Button1
{
margin-left: 424px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div style="text-align: center">
<h2 class="style1">
<b>LOADING AND UNLOADING A USER DEFINED PAGE
</b>
</h2>
<br />
CLICK THE <b>OPEN</b> BUTTON TO LOAD THE USER DEFINED PAGE
AND
CLICK THE <b>CLOSE</b> BUTTON TO UNLOAD THE WEBPAGE</div>
<p>
</p>
<p>
&n
bsp; &nbs
p;
<input id="Button1" type="button" value="OPEN" onclick="click1()"/></p>
<p>
&n
bsp; &nbs
p; </p>
<br/>
&n
bsp;
<input id="Button2" type="button" value="CLOSE" onclick="click2()"/></form>
<p>
</p>
</body>
</html>
Default2.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<style type="text/css">
.style1
{
font-family: "Times New Roman", Times, serif;
}
.style3
{
text-align: center;
font-family: "Times New Roman", Times, serif;
}
.style4
{
background-color: #00CC00;
}
.style5
{
font-family: "Times New Roman", Times, serif;
text-align: center;
background-color: #FF9933;
}
.style6
{
background-color: #FF9933;
}
.style7
{
width: 507px;
text-align: right;
margin-left: 193px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div style="margin-left: 160px">
<h1 class="style3">
</h1>
<h1 class="style3">
<span class="style4">CTTE COLLEGE FOR WOMEN</span></h1>
<p class="style3">
</p>
<h2 class="style7">
<br class="style1" />
<span class="style5">NO:16,ST MARYS ROAD,SEMBIUM,</span><span class="style6"><br
class="style1" />
</span>
</h2>
<h2 class="style7">
<span class="style5">CHENNAI-600 068</span></h2>
<h2 class="style7">
<span class="style6"><br class="style1" />
</span><span class="style5">PHONE-2537 5753.</span></h2>
</div>
</form>
</body>
</html>
OUTPUT:
Thus, an ASP.NET application for loading and unloading a user defined page has been designed
and executed successfully.
EX:NO:21 COOKIES
AIM:
To design on Asp.net application that will implement a hit counter using cookies.
ALGORITHM:
SOURCE CODE:
Default.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<style type="text/css">
.style1
{
font-family: "Times New Roman", Times, serif;
font-size: xx-large;
}
.style2
{
text-decoration: underline;
font-weight: bold;
}
.style3
{
font-size: large;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<span class="style1"> <span
class="style2">COOKIES</span></span></div>
<p>
<span
class="style3">
<asp:Label ID="Label1" runat="server" Text="Enter your name"></asp:Label>
</span>
<asp:TextBox ID="TextBox1" runat="server" Width="170px"></asp:TextBox>
</p>
<p>
<asp:Button ID="Button1" runat="server" Height="40px" Text="Manipulate cookie"
Width="151px" />
<asp:Button ID="Button2" runat="server" Height="40px" Text="Login"
Width="116px" />
<asp:Button ID="Button3" runat="server" Height="36px" Text="Delete"
style="margin-left: 0px" Width="138px" />
</p>
<asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
</form>
</body>
</html>
Default.aspx.vb
'For ct = 0 To n - 1
' For Each y In Request.Cookies(x)
' 'MsgBox(Request.Cookies.Item(ct).Value)
' 'If Request.Cookies.Item(ct).Value <> Nothing Then
' Label2.Text = Label2.Text & " " & Request.Cookies.Item(ct).Name & vbCrLf &
Request.Cookies.Item(ct).Value & vbCrLf & Request.Cookies("user[" & ct & "]")("uname")
' 'End If
' Next
End Sub
End If
End Sub
COOKIES
CONCLUSION:
Thus, the Cookie in Hit Counter using ASP.NET application has been executed successfully.