Presentation is loading. Please wait.

Presentation is loading. Please wait.

ASP. 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.

Similar presentations


Presentation on theme: "ASP. 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."— Presentation transcript:

1 ASP

2 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 PWS (Personal Web Server) is a smaller - but fully functional - version of IIS To run IIS you must have Windows NT 4.0 or later To run PWS you must have Windows 95 or later

3 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"

4 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 Provide security - since ASP code cannot be viewed from the browser Clever ASP programming can minimize the network traffic

5 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.

6 How to Install IIS on Windows 7 and Windows Vista Follow these steps to install IIS: Open the Control Panel from the Start menu Double-click Programs and Features Click "Turn Windows features on or off" (a link to the left) Select the check box for Internet Information Services (IIS), and click OK

7 Test Your Web After you have installed IIS or PWS follow these steps: Look for a new folder called Inetpub on your hard drive Open the Inetpub folder, and find a folder named wwwroot Create a new folder, like "MyWeb", under wwwroot Write some ASP code and save the file as "test1.asp" in the new folder Make sure your Web server is running Open your browser and type "http://localhost/MyWeb/test1.asp", to view your first web page

8 ASP Basic Syntax Rules An ASP file normally contains HTML tags, just like an HTML file. any ASP server script must be surrounded by the symbols

9 The response.write Command

10 ASP Variables

11 Procedures A Sub procedure: is a series of statements, enclosed by the Sub and End Sub statements can perform actions, but does not return a value can take arguments

12 Procedures Result:

13 Function Procedure A Function procedure: is a series of statements, enclosed by the Function and End Function statements can perform actions and can return a value can take arguments that are passed to it by a calling procedure without arguments, must include an empty set of parentheses () returns a value by assigning a value to its name

14 Function A Function procedure can return a result.

15 ASP OBJECTS RESPONSE: The ASP Response object is used to send output to the user from the server. Property: Buffer: response.Buffer[=Flag ] False indicates no buffering. The server will send the output as it is processed. True indicates buffering. The server will not send output until all of the scripts on the page have been processed, or until the Flush or End method has been called.

16 Response Methods: Redirect: Redirects the user to a different URL Write: Writes a specified string to the output Clear: Clears any buffered HTML output End: Stops processing a script, and returns the current result Flush: Sends buffered HTML output immediately

17 Response.clear This is some text I want to send to the user. No, I changed my mind. I want to clear the text. Output: (nothing)

18 Response.End I am writing some text. This text will never be finished! It's too late to write more! Output: I am writing some text. This text will never be

19 Request Object The Request object is used to get information from a visitor. Collections: Form Contains all the form (input) values from a form that uses the post method (POST Method) QueryString Contains all the variable values in a HTTP query string (GET Method) ServerVariables Contains all the server variable values

20 ServerVariables You can loop through all of the server variables like this: ") next %>

21 ServerVariables You are browsing this site with: Your IP address is: The server's domain name: The server's port: The server's software: http://www.w3schools.com/asp/coll_servervariables.asp

22 QueryString First name: Last name: http://www.w3schools.com/asp/showasp.asp?filename=demo_sim plereqquery

23 QueryString Your name: "" Then Response.Write("Hello " & fname & "! ") Response.Write("How are you today?") End If %> http://www.w3schools.com/asp/showasp.asp?filename=demo_reqqu ery

24 Request.Form First name: Last name: The information received from the form above was: <% If Request.Form("name")<>"" Then Response.Write(" ") Response.Write("name=" & Request.Form("name")) Response.Write(" ") Response.Write("The name property's count is: ") Response.Write(Request.Form(" name").Count) Response.Write(" ") Response.Write("First name=" & Request.Form("name")(1)) Response.Write(" ") Response.Write("Last name=" & Request.Form("name")(2)) Response.Write(" ") End if %>

25 http://www.w3schools.com/asp/showasp.asp ?filename=demo_form2 http://www.w3schools.com/asp/showasp.asp ?filename=demo_form2

26 Cookies A cookie is often used to identify a user. A cookie is a small file that the server embeds on the user's computer. It is a small piece of data sent from a website and stored in a user's web browser while the user is browsing that website.web browser Every time the user loads the website, the browser sends the cookie back to the server to notify the website of the user's previous activity

27 Cookies With ASP, you can both create and retrieve cookie values. The "Response.Cookies" command is used to create cookies. The Response.Cookies command must appear BEFORE the tag.

28 Session A Session object stores information about, or change settings for a user session. Variables stored in a Session object hold information about one single user, and are available to all pages in one application. Common information stored in session variables are name, id, and preferences. The server creates a new Session object for each new user, and destroys the Session object when the session expires.


Download ppt "ASP. 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."

Similar presentations


Ads by Google