[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1903
  • Last Modified:

Web Site Development Help ASP Page does not display

Running IIS 6 on Windows 2003 R2 Standard  SP3
Have a web site that works fine.

I have many pages written is ASP and they all work fine.

It is one of those it was working and now it is not.
NO changes to the asp code.

The Server was rebuilt a while back onto a new server box.

I copied the folders from the original server.

Only one page does not display. No Error message just a blank screen.

The Home Page has a hyper link to a sign guestbook
That's presents guestbook.htm

on the guestbook.htm page a hyperlink to guestbook.asp which is suppose to display the contents of the guestbook.


I can also get at it by
example www.mydomain.com\guestbook.asp


GUESTBOOK.HTM

<html>  
 
<head>  
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">  
<title>Name</title>  
<!--mstheme--><link rel="stylesheet" type="text/css" href="_themes/zero/zero1011.css"><meta name="Microsoft Theme" content="zero 1011, default">
</head>  
 
<body>  
<a href=guestbook.asp>See guestbook</a><p>  
<FORM ACTION="guestbook.asp" METHOD=post>  
Your name<br>  
<input type=text name=visitorsname size=25><br>  
Your email<br>    
<input type=text name=visitorsemail size=25><br>    
Your message<br>  
<textarea name=visitorsmessage rows=4 Cols=80>  
</textarea><BR>  
 <img id="imgCaptcha" src="captcha.asp" /><br /><a href="javascript:void(0)" onclick="RefreshImage('imgCaptcha')">Change Image</a> <BR>
<input type=text name=captchacode size=25><br>    
<BR>
<INPUT TYPE=submit value="Post">  
</FORM>  
 
</html>







guestbook.asp

<%
function TestCaptcha(byval valSession, byval valCaptcha)
        dim tmpSession
        valSession = Trim(valSession)
        valCaptcha = Trim(valCaptcha)
        if (valSession = vbNullString) or (valCaptcha = vbNullString) then
                TestCaptcha = false
        else
                tmpSession = valSession
                valSession = Trim(Session(valSession))
                Session(tmpSession) = vbNullString
                if valSession = vbNullString then
                        TestCaptcha = false
                else
                        valCaptcha = Replace(valCaptcha,"i","I")
                        if StrComp(valSession,valCaptcha,1) = 0 then
                                TestCaptcha = true
                        else
                                TestCaptcha = false
                        end if
                end if          
        end if
end function
%>
 
<%
Set fs = CreateObject("Scripting.FileSystemObject")
 
Folderpath=server.mappath("\") & "/cgi-bin/guestbook"  
Wcounter=Folderpath &"/counter.txt"  
 
if request.form<>"" then  
 
        if TestCaptcha("ASPCAPTCHA", Request.Form("captchacode")) then
         
      Wemail = Request.Form("visitorsemail")
      test1=instr(Wemail, "@")                   ' value must be >1
     test2=instr(Wemail, ".")                      ' value must be >4
     test3=len(Wemail)                              ' value must be >6
     test4=InStr (test1,Wemail,".",1)        ' value must be >test1+2
 
     if test1<2 OR test2<5 OR test3<7 OR test4<test1+3 then
        response.write(Wemail & " is not a valid email address<p>")
        email_Test=0
     else
        email_Test=1
     end if  
 
     if  email_Test=1 then
        Set fs = CreateObject("Scripting.FileSystemObject")  
           if fs.FolderExists(Folderpath) then  
                   Set a = fs.OpenTextFile(Wcounter)  
                   counter = Clng(a.ReadLine)  
                counter = counter + 1  
               a.close  
          else  
              Set a = fs.CreateFolder(Folderpath)  
              counter=1  
         end if  
 
        Set a = fs.CreateTextFile(Wcounter,True)  
        a.WriteLine(counter)  
        a.Close  
        Set fs=nothing  
 
        Set fs = CreateObject("Scripting.FileSystemObject")  
        Set a = fs.CreateTextFile(Folderpath & "\" & counter & ".txt")  
        a.WriteLine("<b><a HREF=mailto:" & Request.Form("visitorsemail") & ">" & Request.Form("visitorsname") & "</a></b>")  
        a.WriteLine(Request.Form("visitorsmessage"))  
        a.Close  
        Set a=nothing  
        Set fs=nothing  
       end if
 
                else
                        Response.Write("<b style=""color:#FF0000"">You entered the wrong code.</b>")
                end if
 
end if  
 
 
 
%>
0
Thomas Grassi
Asked:
Thomas Grassi
  • 4
  • 3
1 Solution
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
so nothing displays when you click the link? or does nothing display when you click the button?

if it's the link, it's because of this line:

if request.form<>"" then

when you click a link, nothing is posted, therefore the request object will be empty.

a simple test would be is to add a simple Response.Write at the top of the page and make sure it's not a server setting or a surpressed error.
0
 
Thomas GrassiSystems AdministratorAuthor Commented:
Thanks for your quick responce


On the guestbook.htm page I have a hyperlink "See GUESTBOOK "

when I click on that I get a blank page.

take a look www.tgcsnet.com my home page middle of page your see "Sign our guestbook" link  click on that then you be on the page I am talking about

Then click on "See GUESTBOOK"

My asp code is not the best what would you suggest I but there to test?
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
well that makes sense then. your guestbook.asp page looks like it only saves guestbook entries, there's nothing in the code that displays anything that would display anything. taking a closer look, it looks like it is only validating the CAPTCHA and then trying to write to a text file. if i try to fill out the guestbook, it gives me a permission denied error on line 61.

so lets take a step back here for a sec, what exactly are you trying to accomplish?
0
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
Thomas GrassiSystems AdministratorAuthor Commented:
Ok great

I would like to display the guestbook entries from the link "SEE GUESTBOOK"

I will check the permissions error later on.

Most likely a carrier over from the old server.

Also I may need another page to display the guest book? Something simple to display the text file that is in cgi-bin folder
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
ok, i would then work on getting your save function working properly, make sure the correct permissions are set on your target folder. after that, follow the tutorial below on display the contents of your file to the screen:

http://www.coveryourasp.com/ShowFileDescr.asp
0
 
Thomas GrassiSystems AdministratorAuthor Commented:
I got the permissions fixed.

When I make an entry to the guest book it shows the new entry

But when I click on the post button I get a blank page presented.

Does not end code not bring me back correctly?

Take a look see what you think

Thanks
0
 
Thomas GrassiSystems AdministratorAuthor Commented:
Also figured out the Guestbook not displaying.

Had incorrect name in hyper link.

old http://www.mydomain.com/guestbook.asp
new http://www.mydomain.com/guestbook2.asp

was missing the 2 that code displays the guestbook
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now