IT 4th Practical
IT 4th Practical
Aim: Create webpage to transfer data filled through various HTML form
controls and collection of the same in ASP.
Note:- Put Both html and asp file in C:\inetpub\wwwroot\MyWeb folder and to run html file
write localhost/MyWeb/Main.html in web browser address bar
1) Main.html
<html>
<body>
<br><br><br><br><br>
<font face = "arial">
<form method = "post" action = "transfer.asp" name = "transform">
<table align = "center">
<tr>
<td>Enter your Name :</td>
<td><input type = "text" name = "nametext"></td>
</tr>
<tr>
<td>Enter your Enrollment No :</td>
<td><input type = "text" name = "enotext"></td>
</tr>
<tr>
<td>Current City :</td>
<td>
<select name = "city">
<option value = "Ahmedabad">Ahmedabad</option>
<option value = "Surat">Surat</option>
<option value = "Rajkot">Rajkot</option>
<option value = "Valsad">Valsad</option>
</select>
</td>
</tr>
<tr>
<td>Gender</td>
%>
</body>
</html>
Output
1.Main.html
1. Response.Clear Example
Clear.asp
OUTPUT
After response.Clear
2. Response.End Example
End.asp
OUTPUT
Response.End Example
Before response. End
OUTPUT :-
Response.Flush Example
Before response.Flush
After response.Flush
4. Response.Redirect Example
Redirect.asp
Output:-
' Here is some text on your Web page. Here's some more interesting and illuminating text. some
string
Servervar.asp
<!DOCTYPE html>
<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>
1)Cookie.asp
<html>
<body>
<%
Response.Cookies("user")("firstname")="Snehal"
Response.Cookies("user")("lastname") ="Patel"
Response.Cookies("user")("country") = "India"
Response.Cookies("user")("age") = "25"
%>
</body>
</html>
2) cookiefetch.asp
<html>
<body>
<%
Dim fname, lname, cont, age
fname =Request.Cookies("user")("firstname")
lname =Request.Cookies("user")("lastname")
cont = Request.Cookies("user")("country")
age = Request.Cookies("user")("age")
response.write("Firstname = "&fname)
response.write("<br>")
response.write("Lasttname = "&lname)
response.write("<br>")
response.write("Country = " &cont)
response.write("<br>")
response.write("Age = " & age)
%>
</body>
</html>
Output
cookiefetch.asp
Firstname = Snehal
Lasttname = Patel
Country = India
Age = 25
1)Query.html
<html>
<body>
2) Querystr.asp
<html>
<body>
<%
response.write("First Name : <b>")
response.write(Request.QueryString("fname"))
response.write("</b><br>")
response.write("Last Name : <b>")
response.write(Request.QueryString("lname"))
response.write("</b>")
%>
</body>
</html>
Output
1)Main.html
Output:
The image tag: <img>
2.MapPath
Mappath.asp
<html>
<body>
<%
'MapPath method maps a specified path to a physical path.
Output: C:\inetpub\wwwroot
3 Execute
File1.asp
<html>
<body>
<%
'Execute method executes an ASP file from inside another ASP file. After executing the called .asp file,
the
control is returned to the original .asp file.
response.write("I am in File 1!<br />")
Server.Execute("file2.asp")
response.write("I am back in File 1!")
%>
</body>
</html>
Output:
File1.asp
I am in File 1! I am in File 2!
I am back in File 1!
4.Transfer
File1.asp
<html>
<body>
<%
'The Transfer method sends (transfers) all the state information created in one ASP file to a
second ASP file.
'When the second ASP page completes its tasks, it will NOT return to the first ASP page. After
executing the called .asp file, the control is not returned to the original .asp file.
</body>
</html>
File2.asp
<html>
<body>
<%
response.write("Line 1 in File 2<br />")
response.write("Line 2 in File 2<br />")
%>
</body>
</html>
Output:
File1.asp
Line 1 in File 1
Line 1 in File 2
Line 2 in File 2
OUTPUT
https%3A%2F%2Ffanyv88.com%3A443%2Fhttp%2Fwww%2Egtu%2Eedu%2Ein
</body>
</html>
Output
Client OS WinNT
Web Browser IE
Browser version 8.0
Frame support? True
Table support? True
Sound support? True
Cookies support? True
VBScript support? True
JavaScript support? True
Note: This practical works with IIS 5.0 & 6.0 and will not works with IIS 7.0 or above.
AdRotator.asp
<% option explicit %>
<%
Dim objad
Set objad = server.createobject ("MSWC.adrotator")
%>
<Html>
<Body>
<Center>
<%= objad.getadvertisement ("AdRotator.txt") %>
</Center><Br><hr>
<Center>
<%= objad.getadvertisement ("AdRotator.txt") %>
</Center>