[NEWBIE] Viewing ASP files (.ASP extension)

C

Cassandra Flowers

Dear group,

I have never done any ASP coding before (Just HTML and Javascript as far as
web pages go - and got on fine)

I would like to start writing some ASP scripts, but I am having difficulties
viewing '*.asp' files on my PC, when I open them only the HTML aspects of
the code displays or I just get a blank browser window.. I am running XP, is
there something special that I need to install?

Please forgive me for asking what probably sounds like a stupid question,
but as you have probably gathered I haven't got a clue!!! :eek:)

Thanks,
Cassandra

I am trying to create a simple "Tell A Friend" page. The code I have is as
follows:

****************************************************************************
**********************************************

(File: Functions.asp)
<%
function mail(mMessage, mFrom, mTo, mSubject)
Dim objMail
Set objMail = Server.CreateObject("CDONTS.NewMail")
objMail.From = mFrom
objMail.Subject = mSubject
objMail.To = mTo
objMail.Body = mMessage
objMail.Send
set objMail = nothing
end function

function tellFriend(pageName)
if Request.QueryString("mailsent") = "true" Then
Response.Write "<P><strong>Your recommendation has been
sent.</strong></P>"
end if
Response.Write "<P>To tell a friend about this page, complete your
friend's name and
email address and write your name and email address below.<P>" &vbCrLf
Response.Write "form method = ""post"" action =
""tellafriend_script.asp""> &vbCrLf
Response.Write "<p>Your name:<br />" &vbCrLf
Response.Write "<input type=""text"" name=""senderName"" id=""senderName""
/></P>" &vbCrLf
Response.Write "<P>Your Email Address:<br />" &vbCrLf
Response.Write "<input type=""text"" name=""senderEmail""
id=""senderEmail"" /></P>" &vbCrLf
Response.Write "<p>Your friend's name:<br />" &vbCrLf
Response.Write "<input type=""text"" name=""friendName"" id=""friendName""
/></P>" &vbCrLf
Response.Write "<P>Your Friend's Email Address:<br />" &vbCrLf
Response.Write "<input type=""text"" name=""friendEmail""
id=""friendEmail"" /></P>" &vbCrLf
Response.Write "<input type =""hidden"" name=""pageName"" value=""" &
pageName & """ />" &vbCrLf
Response.Write "<input type =""submit"" value=""send!"" class=""submit"">
</P>" &vbCrLf
Response.Write "</form>" &vbCrLf
end function

%>
****************************************************************************
*********************************************
(File: tellafriend_script.asp)

<%@LANGUAGE = "vbscript"%>
<%Option Explicit%>
<!-#includefile=function.asp"->
<%
Dim senderName, senderEmail, friendName, friendEmail, pageName
Dim mailSubject, mailMessage, sendmail

senderName = Trim(Request.Form("senderName"))
senderEmail = Trim(Request.Form("senderEmail"))
friendName = Trim(Request.Form("friendName"))
friendEmail = Trim(Request.Form("friendEmail"))
pageName = Trim(Request.Form("pageName"))

mailSubject = senderName & " has recommended this web page to you"

mailMessage = "Dear " & friendName & "," &vbCrLf &vbCrLf
mailMessage = mailMessage & "your friend " & senderName & " has recommended
that you visit the following
page." &vbCrLf &vbCrLf
mailMessage = mailMessage & "http://www.yourdomain.com/" & pageName &vbCrLf
&vbCrLf
mailMessage = mailMessage & "We have not stored your details."

sendmail = mail(mailMessage, senderEmail, friendEmail, mailSubject)

Response.Redirect(pageName & "?mailsent=true")

%>

****************************************************************************
**********************************************
(File: Tellafriend.html)

<%@LANGUAGE = "vbscript"%>
<%Option Explicit%>
<!-#includefile=function.asp"->
<%Dim display%>

<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Tell a friend</title>
</head>

<body>
<% display = tellFriend("tellafriend.asp")%>
</body>

</html>
 
R

Rob

To View ASP files, you need to be running windows 95 or 98 and have PWS
(Personal Web Server ) installed.

Alternatively you may also use Windows XP (Pro only) with IIS installed.

Note, windows home edition does not ship with IIS, so it must be the pro
edition.

On all versions of windows, IIS / PWS can be installed from the add / remove
windows components section of add remove programs.

Alternatively insert your windows CD and select the add remove windows
components option.

Once IIS / PWS is installed, you must place all you asp files in
c:\inetpub\wwwroot folder.

You can then view your asp files by browsing to
http://localhost/filename.asp

Hope this helps!
--
Rob Collyer
_______________________________
www.webforumz.com
Free webdesign and development help,
tips, and website critique.
 
J

Jeff Cochran

Dear group,

I have never done any ASP coding before (Just HTML and Javascript as far as
web pages go - and got on fine)

I would like to start writing some ASP scripts, but I am having difficulties
viewing '*.asp' files on my PC, when I open them only the HTML aspects of
the code displays or I just get a blank browser window.. I am running XP, is
there something special that I need to install?

ASP has to be processed by a web server. If you have XP Pro, you can
install IIS (See the IIS group for help on it). XP Home has no web
server. You could put your code on a hosted web server as well.

Jeff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,527
Members
44,999
Latest member
MakersCBDGummiesReview

Latest Threads

Top