Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cannot get ASP page to display 1

Status
Not open for further replies.

Trudye

Programmer
Sep 4, 2001
932
US
I have coded my first ASP page however IE will not display my ASP page. My internet host supports VBscript and ASP. I am running Windows 2000 which (I thought) came with IIS. My file is named Calendar.asp. Can anyone tell me what I am missing?
Here is my code:
<%@ LANGUAGE - VBScript %>
<% option explicit %>

<html>
<head>
<title>Calendar</title>
</head>
<body>
<%
'Get month name
function GetMonthName(iMonth)
Select Case iMonth
Case 1:
GetMonthName = &quot;January&quot;
Case 2:
GetMonthName = &quot;February&quot;
Case 3:
GetMonthName = &quot;March&quot;
Case 4:
GetMonthName = &quot;April&quot;
Case 5:
GetMonthName = &quot;May&quot;
Case 6:
GetMonthName = &quot;June&quot;
Case 7:
GetMonthName = &quot;July&quot;
Case 8:
GetMonthName = &quot;August&quot;
Case 9:
GetMonthName = &quot;September&quot;
Case 10:
GetMonthName = &quot;October&quot;
Case 11:
GetMonthName = &quot;November&quot;
Case 12:
GetMonthName = &quot;December&quot;
Case else:
GetMonthName = &quot;**INVALID MONTH**&quot;
End Select
End Function

'Get current date
Dim dbCurrentDate
dbCurrentDate = Date()

'Create array that will store max number of cells (42)
dim aCalendarDays(42)

'Determine the weekday the first day of the month
'falls on (ie. monday, tuesday etc,)
iFirstWeekDay = DatePart(&quot;w&quot;, DateSerial(dbCurrentDate), _
Month(dbCurrentDate),1))

'Determind number of days in the current month
dim iDaysInMonth
iDaysInMonth = DatePart(&quot;d&quot;, DateSerial(Year(dbCurretnDate), _
Month(dbCurrentDate),1, 1-1))

'Now loop from 1 to number of days in the current month
'populating the array aCalendarDays
dim iLoop
for iLoop = 1 to iDaysInMonth
aCalendarDays(iLoop + iFirstWeekDay -1) = iLoop

'Display the array in calendar form. Black out days that
'are N/A
dim iColumns, IRows
icolumns = 7
iRows = 6 - Int((42 - (iFirstWeekDay + iDaysInMonth)) / 7)

%>
<TABLE ALIGN=CENTER BORDER=1 CELLSPACING=1 WIDTH=75% TEIGHT=75%
<TH COLSPAN=7>
<FONTSIZE=+2>
<%
'Display the month and year
Response.write GetMonthName(month(dbCurrentDate))
response.write &quot;, &quot; & Year(dbCurrentDate)
%>

</FONT>
</TH>
<%
'Loop thru 1 thru iRows, then 1 thru iColumns
dim iRowsLoop, iColumnsLoop

For iRowsLoop = 1 to iRows
'Create a new row
Response.write &quot;<TR>&quot;
For iColumnsLoop = 1 to iColumns
'Create a new col
If aCalendarDays((iRowsLoop -1)*7 + IColumnsLoop) > 0 then
response.write &quot;<TD VALIGN=TOP ALIGN=RIGHT WIDTH=&quot;&quot;14%&quot;&quot;>&quot;
Response.Write aCalendarDays((iRowsLoop-1)*7 + iColumnsLoop)
Response.write &quot;</TD>&quot;
else
Response.write <TD BGCOLOR=BLACK>&NBSP;</TD>&quot;
End if
Next
'close the row
response.write &quot;</TR>&quot;
%>
</Table>
</body>
</html>

Thank you,
Trudye
 
I checked out IIS in Admin Tools;IIS and under LOCAL:Yes, connection type: TCP/IP.

I am not even getting any syntax errors.

Thanks
Trudye
 
Here's a couple of tips that may help

1) In IE, goto advanced options and untick 'Show Friendly HTTP error messages'. This will display any faults that would otherwise be hidden
2) Make sure that you are browsing to the server (e.g. and NOT c:\inetpub\3) Stick some response.writes in your code to debug, for example put <%response.write iMonth%> before your SELECT CASE statement to make sure the contents are what you expect.

If you get an HTTP arror message, post it here if you're still struggling.

Hope this helps,

Graeme



website:
 
Hi,

Are you actually getting the page can not be displayed message? If so there seems to be a little &quot;quirk&quot; with explorer.

Try copying out all your code into notepad or something and replace it with some random text, i.e. &quot;ss&quot;. Save this and refresh your page. You should now see the &quot;ss&quot; displayed in your browser window.

Copy and paste the original code back, save it and refresh the page again, hopefully you will now get a proper error message pointing to a line number...

Ranta
 
You have multiple syntax errors in your code and useless code like the monthname function, have a look at this

<html>
<head>
<title>Calendar</title>
</head>
<body>
<%

Public Function LastDay(testYear,testMonth)
LastDay = Day(DateSerial(testYear, testMonth + 1, 0))
End Function

Dim dbCurrentDate,iColumns, IRows,iDaysInMonth,iLoop,iRowsLoop, iColumnsLoop

dbCurrentDate = Date()

iFirstWeekDay = weekday(year(dbCurrentDate) & &quot;/&quot; & Month(dbCurrentDate) & &quot;/&quot; & &quot;1&quot;)-2
response.write iFirstWeekDay

iDaysInMonth = LastDay(Year(dbCurretnDate),Month(dbCurrentDate))

%>
<TABLE ALIGN=CENTER BORDER=1 CELLSPACING=1 WIDTH=75% TEIGHT=75%
<TH COLSPAN=7>
<FONTSIZE=+2>
<%
Response.write MonthName(month(dbCurrentDate)) & &quot;, &quot; & Year(dbCurrentDate)
%>

</FONT>
</TH>
<%
response.write &quot;<TR>&quot;

For count=1 to 7
response.write &quot;<TD align=center>&quot; & weekdayname(count,1) & &quot;</TD>&quot;
next

response.write &quot;</TR><TR>&quot;

For count=0 to iFirstWeekDay
response.write &quot;<TD></TD>&quot;
next

For count= 1 to iDaysInMonth
if count Mod 7=0 then response.write &quot;</TR><TR>&quot;
response.write &quot;<TD VALIGN=TOP ALIGN=RIGHT WIDTH='14%'>&quot;
Response.Write count
Response.write &quot;</TD>&quot;
next
response.write &quot;</TR>&quot;

%>
</Table>
</body>
</html>

 
Thanks MadJock: I did unck 'Show Friendly HTTP error messages 'and I also unck'd 'Disable a notification about every script error' and there was not change. I had previously uploaded the script via FTP so I was using the actual URL to call it up.

Hi Ranta; what I am getting is a BLANK PAGE. Nothing! NADA!

Thanks GaryC for responding; I expected there to be syntax errors but I thought that the pgm that I use to write scripts would flag them (as it has done in the past with HTML/VBScript). When that did not happen I uploaded the page assuming that there was something special about ASP or that my pgm was unable to handle it. As I wrote to Ranta I get a 'DONE' in the lower left corner of the screen and nothing else just a BLANK PAGE.
I uploaded the page you were kind enough to provide and I got the same thing A BLANK PAGE.
Is it possible I have to contact my Internet Host?

Thanks again guys,
Trudye
 
try this


<%@ Language=VBScript %>
<% 'option explicit %>

<html>
<head>
<title>Calendar</title>
</head>
<body>
<%
'Get month name
function GetMonthName(iMonth)
Select Case iMonth
Case 1:
GetMonthName = &quot;January&quot;
Case 2:
GetMonthName = &quot;February&quot;
Case 3:
GetMonthName = &quot;March&quot;
Case 4:
GetMonthName = &quot;April&quot;
Case 5:
GetMonthName = &quot;May&quot;
Case 6:
GetMonthName = &quot;June&quot;
Case 7:
GetMonthName = &quot;July&quot;
Case 8:
GetMonthName = &quot;August&quot;
Case 9:
GetMonthName = &quot;September&quot;
Case 10:
GetMonthName = &quot;October&quot;
Case 11:
GetMonthName = &quot;November&quot;
Case 12:
GetMonthName = &quot;December&quot;
Case else:
GetMonthName = &quot;**INVALID MONTH**&quot;
End Select
End Function

'Get current date
Dim dbCurrentDate
dbCurrentDate = Date()

'Create array that will store max number of cells (42)
dim aCalendarDays(42)

'Determine the weekday the first day of the month
'falls on (ie. monday, tuesday etc,)
iFirstWeekDay = DatePart(&quot;w&quot;, DateSerial(year(dbCurrentDate), Month(dbCurrentDate),1))

'Determind number of days in the current month
dim iDaysInMonth
iDaysInMonth = DatePart(&quot;d&quot;, DateSerial(Year(dbCurretnDate), Month(dbCurrentDate),0))

'Now loop from 1 to number of days in the current month
'populating the array aCalendarDays
dim iLoop
for iLoop = 1 to iDaysInMonth
aCalendarDays(iLoop + iFirstWeekDay -1) = iLoop
next
'Display the array in calendar form. Black out days that
'are N/A
dim iColumns, IRows
icolumns = 7
iRows = 6 - Int((42 - (iFirstWeekDay + iDaysInMonth)) / 7)

%>
<TABLE ALIGN=CENTER BORDER=1 CELLSPACING=1 WIDTH=75% HEIGHT=75%>
<TH COLSPAN=7>
<FONT SIZE=+2>
<%
'Display the month and year
Response.write GetMonthName(month(dbCurrentDate))
response.write &quot;, &quot; & Year(dbCurrentDate)
%>

</FONT>
</TH>
<%
'Loop thru 1 thru iRows, then 1 thru iColumns
dim iRowsLoop, iColumnsLoop

For iRowsLoop = 1 to iRows
'Create a new row
Response.write &quot;<TR>&quot;
For iColumnsLoop = 1 to iColumns
'Create a new col
If aCalendarDays((iRowsLoop -1)*7 + IColumnsLoop) > 0 then
response.write &quot;<TD VALIGN=TOP ALIGN=RIGHT WIDTH=&quot;&quot;14%&quot;&quot;>&quot;
Response.Write aCalendarDays((iRowsLoop-1)*7 + iColumnsLoop)
Response.write &quot;</TD>&quot;
else
Response.write &quot;<TD BGCOLOR=BLACK>&NBSP;</TD>&quot;
End if
Next
'close the row
response.write &quot;</TR>&quot;
next
%>
</Table>
</body>
</html>
 
Well we are making progress. I am now getting the outline of the calendar but nothing else. I ran the code thru VB 6.0 developer pgm and found that your version was in deed error free.

What else could it be? I ck'd 'automatically ck for IE updates' and added all of the service packs I was missing. I then rebooted but alas no improvment.

Trudye
 
I don't know if you uncommented the option explicit.
But when I did I found 2 more error.

Try this now

<%@ Language=VBScript %>
<% option explicit %>

<html>
<head>
<title>Calendar</title>
</head>
<body>
<%
'Get month name
function GetMonthName(iMonth)
Select Case iMonth
Case 1:
GetMonthName = &quot;January&quot;
Case 2:
GetMonthName = &quot;February&quot;
Case 3:
GetMonthName = &quot;March&quot;
Case 4:
GetMonthName = &quot;April&quot;
Case 5:
GetMonthName = &quot;May&quot;
Case 6:
GetMonthName = &quot;June&quot;
Case 7:
GetMonthName = &quot;July&quot;
Case 8:
GetMonthName = &quot;August&quot;
Case 9:
GetMonthName = &quot;September&quot;
Case 10:
GetMonthName = &quot;October&quot;
Case 11:
GetMonthName = &quot;November&quot;
Case 12:
GetMonthName = &quot;December&quot;
Case else:
GetMonthName = &quot;**INVALID MONTH**&quot;
End Select
End Function

'Get current date
Dim dbCurrentDate
dbCurrentDate = Date()

'Create array that will store max number of cells (42)
dim aCalendarDays(42)
dim iFirstWeekDay
'Determine the weekday the first day of the month
'falls on (ie. monday, tuesday etc,)
iFirstWeekDay = DatePart(&quot;w&quot;, DateSerial(year(dbCurrentDate), Month(dbCurrentDate),1))

'Determind number of days in the current month
dim iDaysInMonth
iDaysInMonth = DatePart(&quot;d&quot;, DateSerial(Year(dbCurrentDate), Month(dbCurrentDate),0))

'Now loop from 1 to number of days in the current month
'populating the array aCalendarDays
dim iLoop
for iLoop = 1 to iDaysInMonth
aCalendarDays(iLoop + iFirstWeekDay -1) = iLoop
next
'Display the array in calendar form. Black out days that
'are N/A
dim iColumns, IRows
icolumns = 7
iRows = 6 - Int((42 - (iFirstWeekDay + iDaysInMonth)) / 7)

%>
<TABLE ALIGN=CENTER BORDER=1 CELLSPACING=1 WIDTH=75% HEIGHT=75%>
<TH COLSPAN=7>
<FONT SIZE=+2>
<%
'Display the month and year
Response.write GetMonthName(month(dbCurrentDate))
response.write &quot;, &quot; & Year(dbCurrentDate)
%>

</FONT>
</TH>
<%
'Loop thru 1 thru iRows, then 1 thru iColumns
dim iRowsLoop, iColumnsLoop

For iRowsLoop = 1 to iRows
'Create a new row
Response.write &quot;<TR>&quot;
For iColumnsLoop = 1 to iColumns
'Create a new col
If aCalendarDays((iRowsLoop -1)*7 + IColumnsLoop) > 0 then
response.write &quot;<TD VALIGN=TOP ALIGN=RIGHT WIDTH=&quot;&quot;14%&quot;&quot;>&quot;
Response.Write aCalendarDays((iRowsLoop-1)*7 + iColumnsLoop)
Response.write &quot;</TD>&quot;
else
Response.write &quot;<TD BGCOLOR=BLACK>&NBSP;</TD>&quot;
End if
Next
'close the row
response.write &quot;</TR>&quot;
next
%>
</Table>
</body>
</html>
 
Hi Sarkman, I'm getting the same response, the outline of the calendar.

OBTW you were right I did not uncomment the Option Explicit. (DUH!)

Is it working in your browser?
Trudye
 
yes. It works fine in my browser. What version are you using?
I am using IE 6.0
 
oh boy that's scary. Yes I am usng IE 6.0. Could it be my Internet Host?

Trudye
 
Is it executing any asp. Try uploading a generic page to see if asp works.

like this
<% Response.write(&quot;ASP works on this server&quot;)
%>
 
I decided not to use my script pgm this time thought it might me the problem. I used Notepad, pasted in your command and save it as asptest.asp.

I uploaded it and then called it up and I got the entire command displayed on the page. Just like this.

<% Response.write(&quot;ASP works on this server&quot;)
%>

Now I'm starting to think conspiracy theory, grassy knoll and all that (LOL).

I know it's something stupid I'm doing I just don't know what it is. Whatever it is I'll never forget it.

TEN

PS. Thanks for hanging in there with me.
 
Hi MadJock,

I'm sorry I found out what the problem was last night. My domain name was not setup for my IH's server it was still pointing to my old IH. That's the good news the bad news is I have to wait 72 hours for the change to take full effect.

Thanks for the heads up on Brinkster. Do they support FrontPage as well? If so I am so there.

Thanks so much for all your help.
Happy holidays to you and yours,
Be well,
Trudye
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top