Professional Documents
Culture Documents
Home work-03
Part-A
Q1. Write an ASP application that displays the multiplication table from 5 × 1 to 5 × 15.
Ans:- <html>
<body>
<%
dim i
dim b
for i=1 to 15
b=5*i
response.write(“5”)
response.write(“*”)
response.write(i)
response.write(“=”)
response.write(“b”)
%>
</body>
</html>
Q2. Write an ASP application that uses cookies to store data of a visitor when it visitor the
website of a Hotel.
Ans: -
<%
dim numvisits
response.cookies("NumVisits").Expires=date+365
numvisits=request.cookies("NumVisits")
if numvisits="" then
response.cookies("NumVisits")=1
response.write("Welcome! Web page.")
else
response.cookies("NumVisits")=numvisits+1
response.write("You have visited this ")
response.write("Web page " & numvisits)
if numvisits=1 then
response.write " time before!"
else
response.write " times before!"
end if
end if
%>
<html>
<body>
</body>
</html>
Ans: -
<html>
<head>
<title>caching</title>
</head>
<body>
<%
Response.CacheControl =”anc”
%>
<%
Application(“Name”) = ”Sandeep”
next
%>
Part-B
Q4. Write an ASP script that displays the domain name of the Web server & full pathname of
the ASP script.
Ans:
<html>
<body>
<b>The server's domain name:</b>
<%Response.Write(Request.ServerVariables("server_name"))%>
</p>
</body>
</html>
Q5. Build an ASP application that uses the Calendar ActiveX control to get a valid date from
the user.
Ans:
<html>
<body>
</body>
</html>
o/p:
Q6. Write an ASP script that displays the IP address of the Web browser.
Ans:
<html>
<body>
<p>
<b>You are browsing this site with:</b>
<%Response.Write(Request.ServerVariables("http_user_agent"))%>
</p>
<p>
<b>Your IP address is:</b>
<%Response.Write(Request.ServerVariables("remote_addr"))%>
</p>
<p>
<b>The DNS lookup of the IP address is:</b>
<%Response.Write(Request.ServerVariables("remote_host"))%>
</p>
<p>
<b>The method used to call the page:</b>
<%Response.Write(Request.ServerVariables("request_method"))%>
</p>
<p>
<b>The server's domain name:</b>
<%Response.Write(Request.ServerVariables("server_name"))%>
</p>
<p>
<b>The server's port:</b>
<%Response.Write(Request.ServerVariables("server_port"))%>
</p>
<p>
<b>The server's software:</b>
<%Response.Write(Request.ServerVariables("server_software"))%>
</p>
</body>
</html>
o/p: