Aug 18, 2018, 02:10 PM

News:

Choose a design and let our professionals help you build a successful website   - ITAcumens


Creating my First ASP Page

Started by sukishan, Aug 20, 2009, 08:14 PM

previous topic - next topic
Go Down

sukishan

If you are reading this page then I shall assume that you are new to ASP and want to create your first dynamic ASP web page.

Before we can begin please make sure you have installed IIS (Internet Information Services) on your system as you need one of these web servers to be able to view a page containing ASP (just opening the page in your web browser by double-clicking on the page will NOT work). If you are unsure on how to install IIS please read the tutorials on, installing IIS.

Right, now we have got that out the way we can begin creating your first ASP page.

In this tutorial we are going to display the classic 'Hello World' text in an web page as well as the time on the web server.

As ASP is going to be displayed as part of a web page we first need to create an HTML web page, open up your favourite text editor and type the following.

   
<html>
<head>
<title>My First ASP Page</title>
</head>
<body bgcolor="white" text="black"> 
   

Next we can begin writing some ASP. Any ASP needs to be placed in between the tags, <% ........ %>, to indicate server-side script. In this next part we will start the server side script tag and create a variable to hold the text 'Hello World'.

   
<%
'Dimension variables
Dim strMessage 
   

Notice I haven't given the variable 'strMessage' a data type, this is because VBScript only has variant as a data type.

Now we have created a variable were going to give it the value 'Hello World'.

   
'Place the value Hello World into the variable strMessage
strMessage = "Hello World" 
   

Once the variable has a value we can now display the contents of the variable in the HTML by using the ASP 'Response.Write' method to place the contents of the variable into the HTTP stream.

   
'Write the contents of the variable strMessage to the web page
Response.Write (strMessage) 
   

Next we shall use the 'Response.Write' method to write a line break into the HTML to create a new line before displaying the server time.

   
'Write line break into the web page
Response.Write ("
") 
   

Again using the 'Response.Write' method and the VBScript function 'Time()' we shall now display the server time on the HTML page and close the serer side script tag as we have finished using ASP in this part of the web page.

   
'Write the server time on the web page using the VBScript Time() function
Response.Write ("The time on the server is: " & Time())

'Close the server script
%> 
   

Finally we need to finish the HTML web page by closing the body tag and the HTML tag.

   
</body>
</html> 
   

Next, call the file, 'my_first_asp_page.asp' (don't forget the '.asp' extension) and save the file to a directory accessible through your web server (this will usually be, 'c:\inetpub\wwwroot', on IIS or PWS with a defualt install).

To display the page open your web browser and type 'http://my_computer/my_first_asp_page.asp', where 'my_computer' is replace this with the name of your computer.

And that's about it, you have now created your first dynamic ASP web page!
A good beginning makes a good ending

pradeep prem

its easy to get details from this website

to know that how to create a asp page

Go Up
 

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it's been approved by a moderator.
Name:
Email:
Verification:
Please leave this box empty:

Type the letters shown in the picture
Listen to the letters / Request another image

Type the letters shown in the picture:

shortcuts: alt+s submit/post or alt+p preview
IT Acumens | GinGly :: SMS Backup | Acumen :: Discussion Board | AshokPillar :: Hosting | CineBuzz :: Latest Cinema News | My Kids Diary :: Capture your kids magical moment
Copyright 2005 - 2017 :: IT Acumens :: All Rights Reserved.
ITAcumens Forum with 2 lakhs post running for 10 years - Powered by HostGator Dedicated Server