By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,867 Members | 1,964 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,867 IT Pros & Developers. It's quick & easy.

How to get ASP pages to work?

P: 11
On the adress: http://www.w3schools.com/asp/showasp.asp?filename=demo_intro
is demo of ASP source:

----------------------------------------------------------
<html>
<body>

<%
response.write("My first ASP script!")
%>

</body>
</html>
----------------------------------------------------------

and output result:
---------------------------------
My first ASP script!
---------------------------------

How much I try to put this code in *.html file and later when try to open this file in browser, it's alwayse appears:

<% response.write("My first ASP script!") %>

instead of:

My first ASP script!

Is there eny way to display result of this code correctly?
Jun 12 '11 #1

✓ answered by jhardman

Three things occur to me reading your post.

1-you said you put this in a "html" page, unless you set your server to look for scripts in pages with ".html" file extension it won't execute the script. Normally we put asp scripts in files with extension ".asp".

2- how are you opening the file? Is it being served by a web server, or are you going into your browser's file menu and selecting "open file"? That last option won't work, the asp script has to be executed by a web server, usually IIS (although there is an add-in to make it work in apache) so you need to give your browser the address of a web server that can execute the script.

3- it sounds like you are just starting out with asp. I am going to encourage you to stop and try a different technology. Asp.net is what M$ is pushing now, classic asp was phased out starting in 2003, now most of us who still use it are just maintaining old web sites. So if you like M$ go to asp.net, otherwise you can try php for the free, open-source lovers.

Let me know if this helps.

Jared

Share this Question
Share on Google+
6 Replies


jhardman
Expert 2.5K+
P: 3,405
Three things occur to me reading your post.

1-you said you put this in a "html" page, unless you set your server to look for scripts in pages with ".html" file extension it won't execute the script. Normally we put asp scripts in files with extension ".asp".

2- how are you opening the file? Is it being served by a web server, or are you going into your browser's file menu and selecting "open file"? That last option won't work, the asp script has to be executed by a web server, usually IIS (although there is an add-in to make it work in apache) so you need to give your browser the address of a web server that can execute the script.

3- it sounds like you are just starting out with asp. I am going to encourage you to stop and try a different technology. Asp.net is what M$ is pushing now, classic asp was phased out starting in 2003, now most of us who still use it are just maintaining old web sites. So if you like M$ go to asp.net, otherwise you can try php for the free, open-source lovers.

Let me know if this helps.

Jared
Jun 12 '11 #2

P: 11
The true is that I just started with ASP. I was thinking that regular "*.asp" file can opened just going into your browser's "file" menu and selecting "open file", didn't know that the asp script has to be executed by a web server.

I like in ASP - FSO (File System Object), with this you can open and writhe something in "*.txt" file or create txt file and much more. TXT files is appropriate for my databases.

Thanks anyway!
Jun 12 '11 #3

jhardman
Expert 2.5K+
P: 3,405
So the next thing you need to decide is which server are you going to install. All windows versions except for "home edition" come with IIS as an optional install. If you have a home edition then you will need to consider using apache or a remote host to test your scripts. The downside of apache is that it doesn't natively support asp scripts, you have to add that as an add-on.

Jared
Jun 14 '11 #4

P: 14
Just create an asp page with your script and then do an include file script into your html page. It will include your asp page into your html page. That will work. All asp script must be in a asp extension page but you can include into any page you want. Even php pages as long as you have asp extension enable on you server.
Jun 14 '11 #5

P: 11
When I include ASP script into HTML page, is it necessary server like IIS and apache or I can just run into web browser without making the web server?
Aug 4 '11 #6

jhardman
Expert 2.5K+
P: 3,405
ASP stands for "active server page". Yes, you need the page served by a server. Even if you want to do a "server-side include" the server needs to be running to make the include statement work.

Jared
Aug 4 '11 #7

Post your reply

Sign in to post your reply or Sign up for a free account.