What is ASP?
ASP stands for Active Server Pages
ASP is a Microsoft Technology
ASP is a program that runs inside IIS
IIS stands for Internet Information Services


What is an ASP File?
An ASP file is just the same as an HTML file
An ASP file can contain text, HTML, XML, and scripts
Scripts in an ASP file are executed on the server
An ASP file has the file extension ".asp"


What can ASP do for you?
Dynamically edit, change, or add any content of a Web page
Respond to user queries or data submitted from HTML forms
Access any data or databases and return the results to a browser
Customize a Web page to make it more useful for individual users
The advantages of using ASP instead of CGI and Perl, are those of simplicity and speed
Provide security - since ASP code cannot be viewed from the browser
Clever ASP programming can minimize the network traffic

IIS - Internet Information Server
IIS is a set of Internet-based services for servers created by Microsoft for use with Microsoft Windows.
IIS comes with Windows 2000, XP, Vista, and Windows 7. It is also available for Windows NT.
IIS is easy to install and ideal for developing and testing web applications.

PWS - Personal Web Server
PWS is for older Windows system like Windows 95, 98, and NT.
PWS is easy to install and can be used for developing and testing web applications including ASP.
We don't recommend running PWS for anything else than training. It is outdated and has security issues.


ASP Basic Syntax Rules
----------------------------------------------------------
<html>
<body>

<%
response.write("Hello World!")
%>

</body>
</html>

----------------------------------------------------------

<html>
<head>
<%
sub vbproc(num1,num2)
response.write(num1*num2)
end sub
%>
</head>
<body>

<p>Result: <%call vbproc(3,4)%></p>

</body>
</html>

----------------------------------------------------------

Add parameters to a URL

<a href="l2j.asp?fname=jinjuya">Go to Page</a>

http://www.duraboys.net/l2j.asp?fname=jinjuya

<%
fname=Request.querystring("fname")
response.write("<p>Hello " & fname &"!</p>")
%>


----------------------------------------------------------

Use a form

<form method="post" action="l2j.asp">
Name: <input type="text" name="fname" value="" />
<input type="submit" value="Submit" />
</form>

<%
fname=Request.form("fname")
response.write("<p>Hello " & fname & "!</p>")
%>

----------------------------------------------------------

<%
Response.Cookies("firstname")="Alex"
Response.Cookies("firstname").Expires=#May 10,2012#
%>

----------------------------------------------------------

<%
fname=Request.Cookies("firstname")
response.write("Firstname=" & fname)
%>

----------------------------------------------------------

<%
Response.Cookies("user")("firstname")="John"
Response.Cookies("user")("lastname")="Smith"
Response.Cookies("user")("country")="Norway"
Response.Cookies("user")("age")="25"
%>

----------------------------------------------------------

<%
Response.Cookies("firstname")="Alex"
Response.Cookies("user")("firstname")="John"
Response.Cookies("user")("lastname")="Smith"
Response.Cookies("user")("country")="Norway"
Response.Cookies("user")("age")="25"
%>

----------------------------------------------------------

<html>
<body>

<%
dim x,y
for each x in Request.Cookies
  response.write("<p>")
  if Request.Cookies(x).HasKeys then
    for each y in Request.Cookies(x)
      response.write(x & ":" & y & "=" & Request.Cookies(x)(y))
      response.write("<br />")
    next
  else
    Response.Write(x & "=" & Request.Cookies(x) & "<br />")
  end if
  response.write "</p>"
next
%>

</body>
</html>

Output:

firstname=Alex

user:firstname=John
user:lastname=Smith
user:country=Norway
user:age=25

----------------------------------------------------------

'asp' 카테고리의 다른 글

Windows2008 x64 Server.CreateObject("DEXT.FileUpload") 오류  (4) 2012.11.18
Request.ServerVariables  (0) 2012.09.20
asp utf-8 한글  (0) 2011.06.06
adXactAbortRetaining  (0) 2011.05.30
Working with ASP Applications  (0) 2011.05.24

+ Recent posts