ASP Introduction and Installation
ASP stands for Active Server Page. It is commonly known as Classic ASP or ASP Classic. ASP is a server-side scripting language that is used for executing the scripts on the webserver. This technology was developed by Microsoft. It is an old but still useful tool used to create dynamic webpages.
ASP is a program that runs inside a web server. Active Server Pages is a programming environment that gives you the ability to generate interactive dynamic HTML pages with the help of client-side and server-side scripting.
What does the ASP file contain:
An ASP file has an extension “.asp”. It is the same as HTML Files. An ASP file can contain server scripts in addition to HTML Tags. In an ASP page, VB Script is usually used as a server-side and JavaScript as the client scripting language.
Uses of ASP:
- It is used to get or retrieve the data from the form when the form will be submitted by users. For example, you can have users submit their e-mail addresses to be added to a mailing list.
- It is used to edit. Change and add more content to a webpage and create a customized website.
- It is used to get and set the cookies from the web Browser.
- It is used to give responses to user queries.
- It is used to communicate with databases means to read data stored in a database or write new data to a database.
- It is used to implement sessions. Basically, a session is a way to store information about what happens during a user’s visit to a website. Through this mechanism, you’ll be able to store information about the user like at what time they visited a page.
How does it work?
- When the web Browser requests an HTML File to the webserver then it will return the file o the web browser.
- On the other hand. When the client requests an ASP file then the server passes over the requests to the ASP engine.
- An ASP engine is used to read the ASP file Content and executing the server scripts.
- In the end. The file returns to the Browser as Plain text.
How to run ASP File?
- Firstly download and install a setup on your computer.
- Press the Windows + R key and type appwiz.cpl in the Run box and press enter.
- Select “Turn Windows features on or off”
- Now click on the Internet Information Services check box and select sub-components are given below. It will take some time after click OK.
- Go to your browser and navigate to localhost.
- After Installation, Search for a new folder named “Inetpub” on the hard drive of your PC.
- Inside the “Inetpub” Folder, Open a new folder called”wwwroot.”.
C:\inetpub\wwwroot
- Create a new folder named “Beginner” inside wwwroot.
- Create a new file named “GFG.asp” inside Beginner Folder.
- Write some ASP code and save the file as “GFG.asp”.
- Now, check that your web server is running properly or not.
- In the end, Open your browser and type “http://localhost/Beginner/GFG.asp”, to view your first web page
Example: A Simple Hello world Program in ASP.
ASP
<!DOCTYPE html> < html > < body > <% response.write("Hello World") %> </ body > </ html > |
Output:
Hello World
Explanation: This is a very basic example of a Classic ASP page that returns the phrase “Hello World” to the browser along with the rest of the standard HTML. The HTML portions are static, i.e. the server will send them to the browser as-is. The parts delimited by <% %> are what the server will actually process before sending it to the client.