error using asp and conditional SSI

G

Guest

this post is going to be a bit long but lots of code so sorry about that. My
problem is that I have a an asp page that has lots of includes. But I needed
to have a way to include certain files based on a condition. I came across
conditional SSI. I created the myprofile page below which has the
coniditional SSI. When I run the page i get a an expected END error on the
included member.asp page also below. Not sure what the problem is because its
on line 45 and there is only a response.write there and only one if statement
on the entire page. I would appreciate any help on getting this resolved.
Thanks

'********* myprofile.asp *************

<!--#include file="includes/verify.asp" -->
<!--#include file="includes/functions.asp" -->
<!--#include file="includes/header.asp" -->
<!--#include file="includes/navigation.asp" -->
<%
On Error Resume Next
Call OpenDB()
'*****////////// Recordsets /////////////************************
GetTeamSQL = "Select * from tblteams where TeamMembers ='" & strusername & "'"
Set rsGetTeam = dbConn.Execute(GetTeamSQL)
ProfileSQL = "Select * from tblmembers where UserName ='" & strusername & "'"
Set rsProfile = dbConn.Execute(ProfileSQL)
ListTeamsSQL = "Select DISTINCT Team from tblteams"
Set rsListTeams = dbConn.Execute(ListTeamsSQL)
'*****////////// END Recordsets /////////////************************


'****////////// SCRIPT FOR CONFIRMING MEMBERS - CAPTAINS ONLY
///////////////////***********
If Request.form("confirm") <> "" OR IsNull(Request.form("confirm")) Then
struser = Request.form("form_username")
If Request.form("confirm") = "Confirm" Then
confirmSQL = "Update tblteams set Active = True WHERE TeamMembers ='" &
struser & "'"
Set rsconfirm = dbConn.Execute(confirmSQL)
Elseif Request.form("confirm") = "Remove" Then
DeleteSQL = "Delete from tblteams WHERE TeamMembers ='" & struser & "'"
Set rsDelete = dbConn.Execute(DeleteSQL)
End IF
If IsObject(FORMDATA) = True Then
FORMDATA.RemoveAll 'Clear the form values
End IF
End IF

'****//////////// END OF CONFIRM MEMBER SCRIPT
/////////////////////*******************

'set a level of membership for the user on the team
If rsGetTeam.eof Then
Response.redirect("myprofile.asp?level=freeagent")
ElseIf rsGetTeam("Captain")= True Then
Response.redirect("myprofile.asp?level=Captain")
ElseIf rsGetTeam("CoCaptain") = True Then
response.redirect("myprofile.asp?level=CoCaptain")
ElseIf rsGetTeam("Active") = False Then
response.redirect("myprofile.asp?level=Pending")
Else
response.redirect("myprofile.asp?level=member")
End If
%>
'*********conditional SSI *************************
<!--#if expr="${QUERY_STRING} = /level=freeagent/" -->
<!--#include file="includes/freeagent.asp" -->
<!--#elif expr="${QUERY_STRING} = /level=captain/" -->
<!--#include file="includes/captain.asp" -->
<!--#elif expr="${QUERY_STRING} = /level=cocaptain/" -->
<!--#include file="includes/cocaptain.asp" -->
<!--#elif expr="${QUERY_STRING} = /level=pending/" -->
<!--#include file="includes/pending.asp" -->
<!--#elif expr="${QUERY_STRING} = /level=member/" -->
<!--#include file="includes/member.asp" -->
<!--#endif -->

<!--#include file="includes/footer.asp" -->

'********member.asp*************
<table width="100%" border="0" cellpadding="3">
<tr>
<td colspan="3"><div align="center">Profile: <%=strusername%></div></td>
</tr>
<tr>
<td width="19%"><div align="right">Team:</div></td>
<td width="41%"><%=rsGetTeam("Team")%></td>
<td width="40%"><div align="center">Team
Members(<%=CountTeamMembers(rsGetTeam("Team"))%>)</div></td>
</tr>
<tr>
<td><div align="right">Motto:</div></td>
<td><%=rsGetTeam("Motto")%>
<td rowspan="8" valign="top"><p align="center">::: Cornfirmed :::</p>
<p>
<%
If not rsCountTeamMembers.eof Then
While Not rsCountTeamMembers.eof
Response.Write(rsCountTeamMembers("TeamMembers") + "<br>")
rsCountTeamMembers.movenext
WEND
End If
%>
</p>
<p align="center"> </p>
<p align="center"> </p></td>
</tr>
<tr>
<td><div align="right">Description:</div></td>
<td><%=rsGetTeam("Description")%></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td><div align="right">Name:</div></td>
<td><%=rsProfile("First") & " " & rsProfile("Last")%></td>
</tr>
<tr>
<td><div align="right">XBox Live Tag:</div></td>
<td><%=strusername%></td>
</tr>
<tr>
<td><div align="right">E-mail:</div></td>
'************line 45 ********************
<td><%=rsProfile("Email")%></td>
</tr>
<tr>
<td> </td>
<td>
</tr>
<tr>
<td> </td>
<td>
</tr>
</table>
 
T

Thomas A. Rowe

You need to rewrite your conditional SSI in the following example format:

If Something = "/level=freeagent/" Then
<!--#include file="includes/freeagent.asp" -->
ElseIf something = "/level=captain/" Then
<!--#include file="includes/captain.asp" -->
End If


When test your script be sure to comment out:

On Error Resume Next

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
==============================================
If you feel your current issue is a results of installing
a Service Pack or security update, please contact
Microsoft Product Support Services:
http://support.microsoft.com
If the problem can be shown to have been caused by a
security update, then there is usually no charge for the call.
==============================================
 
T

Thomas A. Rowe

Also see:

http://www.4guysfromrolla.com/webtech/022504-1.shtml

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
==============================================
If you feel your current issue is a results of installing
a Service Pack or security update, please contact
Microsoft Product Support Services:
http://support.microsoft.com
If the problem can be shown to have been caused by a
security update, then there is usually no charge for the call.
==============================================
 
G

Guest

Ok,
I followed the steps from the 4guysfromrolla article and my code is looking
better becasue of that. but whenever I go to execute the file it doesnt
matter whether its the captain or freeagent or member include I am still
getting the Expected End error on the execute line. here are my new pages.
Im thinking now that the problem isnt the includes since they all do it but I
can seem to understand why there are only 2 groups of include statements on
the profile page and both are fully ended. Thanks for the help

''''''''''''''''''''myprofile.asp'''''''''''''''''''''''''''
<!--#include file="includes/verify.asp" -->
<!--#include file="includes/functions.asp" -->
<!--#include file="includes/header.asp" -->
<!--#include file="includes/navigation.asp" -->
<%
'On Error Resume Next
Call OpenDB()
'*****////////// Recordsets /////////////************************
GetTeamSQL = "Select * from tblteams where TeamMembers ='" & strusername & "'"
Set rsGetTeam = dbConn.Execute(GetTeamSQL)
ProfileSQL = "Select * from tblmembers where UserName ='" & strusername & "'"
Set rsProfile = dbConn.Execute(ProfileSQL)
ListTeamsSQL = "Select DISTINCT Team from tblteams"
Set rsListTeams = dbConn.Execute(ListTeamsSQL)
'*****////////// END Recordsets /////////////************************


'****////////// SCRIPT FOR CONFIRMING MEMBERS - CAPTAINS ONLY
///////////////////***********
If Request.form("confirm") <> "" And Not IsNull(Request.form("confirm")) Then
struser = Request.form("form_username")
If Request.form("confirm") = "Confirm" Then
confirmSQL = "Update tblteams set Active = True WHERE TeamMembers ='" &
struser & "'"
Set rsconfirm = dbConn.Execute(confirmSQL)
Elseif Request.form("confirm") = "Remove" Then
DeleteSQL = "Delete from tblteams WHERE TeamMembers ='" & struser & "'"
Set rsDelete = dbConn.Execute(DeleteSQL)
End IF
If IsObject(FORMDATA) = True Then
FORMDATA.RemoveAll 'Clear the form values
End IF
End IF

'****//////////// END OF CONFIRM MEMBER SCRIPT
/////////////////////*******************

'set a level of membership for the user on the team
If rsGetTeam.eof Then
strinclude = fixInclude(getMappedFileAsString("includes/freeagent.asp"))
ElseIf rsGetTeam("Captain")= True Then
strinclude = fixInclude(getMappedFileAsString("includes/captain.asp"))
ElseIf rsGetTeam("CoCaptain") = True Then
strinclude = fixInclude(getMappedFileAsString("includes/cocaptain.asp"))
ElseIf rsGetTeam("Active") = False Then
strinclude = fixInclude(getMappedFileAsString("includes/pending.asp"))
Else
strinclude = fixInclude(getMappedFileAsString("includes/member.asp"))
End If
'''''''''''''''''' here is where the expected end error is reported
Execute (strinclude)
%>

<!--#include file="includes/footer.asp" -->

''''''''''member.asp''''''''''''''''''''''''''''''
<table width="100%" border="0" cellpadding="3">
<tr>
<td colspan="3"><div align="center">Profile: <%strusername%></div></td>
</tr>
<tr>
<td width="19%"><div align="right">Team:</div></td>
<td width="41%"><%rsGetTeam("Team"%></td>
<td width="40%"><div align="center">Team
Members(<%CountTeamMembers(rsGetTeam("Team"))%>)</div></td>
</tr>
<tr>
<td><div align="right">Motto:</div></td>
<td><%rsGetTeam("Motto")%>
<td rowspan="8" valign="top"><p align="center">::: Cornfirmed :::</p>
<p>
<%
If not rsCountTeamMembers.eof Then
While Not rsCountTeamMembers.eof
Response.Write(rsCountTeamMembers("TeamMembers") + "<br>")
rsCountTeamMembers.movenext
WEND
End If
%>
</p>
<p align="center"> </p>
<p align="center"> </p></td>
</tr>
<tr>
<td><div align="right">Description:</div></td>
<td><%rsGetTeam("Description")%></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td><div align="right">Name:</div></td>
<td><%rsProfile("First") & " " & rsProfile("Last")%></td>
</tr>
<tr>
<td><div align="right">XBox Live Tag:</div></td>
<td><%strusername%></td>
</tr>
<tr>
<td><div align="right">E-mail:</div></td>
<td><%rsProfile("Email")%></td>
</tr>
<tr>
<td> </td>
<td>
</tr>
<tr>
<td> </td>
<td>
</tr>
</table>
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
 
S

Stefan B Rusynko

Look for the error in 1 of the 5 include pages you are trying to execute since they are executing before the line you are getting
the error at
(probably includes/member.asp since it is the default if all else fails in your IF )

Check what you are passing to your IF (and includes) at that point (before the IF) using say
Response.write rsGetTeam("Captain") & "<br>"
Response.write rsGetTeam("CoCaptain") & "<br>"
Response.write rsGetTeam("Active") & "<br>"

--




| Ok,
| I followed the steps from the 4guysfromrolla article and my code is looking
| better becasue of that. but whenever I go to execute the file it doesnt
| matter whether its the captain or freeagent or member include I am still
| getting the Expected End error on the execute line. here are my new pages.
| Im thinking now that the problem isnt the includes since they all do it but I
| can seem to understand why there are only 2 groups of include statements on
| the profile page and both are fully ended. Thanks for the help
|
| ''''''''''''''''''''myprofile.asp'''''''''''''''''''''''''''
| <!--#include file="includes/verify.asp" -->
| <!--#include file="includes/functions.asp" -->
| <!--#include file="includes/header.asp" -->
| <!--#include file="includes/navigation.asp" -->
| <%
| 'On Error Resume Next
| Call OpenDB()
| '*****////////// Recordsets /////////////************************
| GetTeamSQL = "Select * from tblteams where TeamMembers ='" & strusername & "'"
| Set rsGetTeam = dbConn.Execute(GetTeamSQL)
| ProfileSQL = "Select * from tblmembers where UserName ='" & strusername & "'"
| Set rsProfile = dbConn.Execute(ProfileSQL)
| ListTeamsSQL = "Select DISTINCT Team from tblteams"
| Set rsListTeams = dbConn.Execute(ListTeamsSQL)
| '*****////////// END Recordsets /////////////************************
|
|
| '****////////// SCRIPT FOR CONFIRMING MEMBERS - CAPTAINS ONLY
| ///////////////////***********
| If Request.form("confirm") <> "" And Not IsNull(Request.form("confirm")) Then
| struser = Request.form("form_username")
| If Request.form("confirm") = "Confirm" Then
| confirmSQL = "Update tblteams set Active = True WHERE TeamMembers ='" &
| struser & "'"
| Set rsconfirm = dbConn.Execute(confirmSQL)
| Elseif Request.form("confirm") = "Remove" Then
| DeleteSQL = "Delete from tblteams WHERE TeamMembers ='" & struser & "'"
| Set rsDelete = dbConn.Execute(DeleteSQL)
| End IF
| If IsObject(FORMDATA) = True Then
| FORMDATA.RemoveAll 'Clear the form values
| End IF
| End IF
|
| '****//////////// END OF CONFIRM MEMBER SCRIPT
| /////////////////////*******************
|
| 'set a level of membership for the user on the team
| If rsGetTeam.eof Then
| strinclude = fixInclude(getMappedFileAsString("includes/freeagent.asp"))
| ElseIf rsGetTeam("Captain")= True Then
| strinclude = fixInclude(getMappedFileAsString("includes/captain.asp"))
| ElseIf rsGetTeam("CoCaptain") = True Then
| strinclude = fixInclude(getMappedFileAsString("includes/cocaptain.asp"))
| ElseIf rsGetTeam("Active") = False Then
| strinclude = fixInclude(getMappedFileAsString("includes/pending.asp"))
| Else
| strinclude = fixInclude(getMappedFileAsString("includes/member.asp"))
| End If
| '''''''''''''''''' here is where the expected end error is reported
| Execute (strinclude)
| %>
|
| <!--#include file="includes/footer.asp" -->
|
| ''''''''''member.asp''''''''''''''''''''''''''''''
| <table width="100%" border="0" cellpadding="3">
| <tr>
| <td colspan="3"><div align="center">Profile: <%strusername%></div></td>
| </tr>
| <tr>
| <td width="19%"><div align="right">Team:</div></td>
| <td width="41%"><%rsGetTeam("Team"%></td>
| <td width="40%"><div align="center">Team
| Members(<%CountTeamMembers(rsGetTeam("Team"))%>)</div></td>
| </tr>
| <tr>
| <td><div align="right">Motto:</div></td>
| <td><%rsGetTeam("Motto")%>
| <td rowspan="8" valign="top"><p align="center">::: Cornfirmed :::</p>
| <p>
| <%
| If not rsCountTeamMembers.eof Then
| While Not rsCountTeamMembers.eof
| Response.Write(rsCountTeamMembers("TeamMembers") + "<br>")
| rsCountTeamMembers.movenext
| WEND
| End If
| %>
| </p>
| <p align="center"> </p>
| <p align="center"> </p></td>
| </tr>
| <tr>
| <td><div align="right">Description:</div></td>
| <td><%rsGetTeam("Description")%></td>
| </tr>
| <tr>
| <td> </td>
| <td> </td>
| </tr>
| <tr>
| <td><div align="right">Name:</div></td>
| <td><%rsProfile("First") & " " & rsProfile("Last")%></td>
| </tr>
| <tr>
| <td><div align="right">XBox Live Tag:</div></td>
| <td><%strusername%></td>
| </tr>
| <tr>
| <td><div align="right">E-mail:</div></td>
| <td><%rsProfile("Email")%></td>
| </tr>
| <tr>
| <td> </td>
| <td>
| </tr>
| <tr>
| <td> </td>
| <td>
| </tr>
| </table>
| ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
|
| "Thomas A. Rowe" wrote:
|
| > Also see:
| >
| > http://www.4guysfromrolla.com/webtech/022504-1.shtml
| >
| > --
| > ==============================================
| > Thomas A. Rowe (Microsoft MVP - FrontPage)
| > ==============================================
| > If you feel your current issue is a results of installing
| > a Service Pack or security update, please contact
| > Microsoft Product Support Services:
| > http://support.microsoft.com
| > If the problem can be shown to have been caused by a
| > security update, then there is usually no charge for the call.
| > ==============================================
| >
| > > You need to rewrite your conditional SSI in the following example format:
| > >
| > > If Something = "/level=freeagent/" Then
| > > <!--#include file="includes/freeagent.asp" -->
| > > ElseIf something = "/level=captain/" Then
| > > <!--#include file="includes/captain.asp" -->
| > > End If
| > >
| > >
| > > When test your script be sure to comment out:
| > >
| > > On Error Resume Next
| > >
| > > --
| > > ==============================================
| > > Thomas A. Rowe (Microsoft MVP - FrontPage)
| > > ==============================================
| > > If you feel your current issue is a results of installing
| > > a Service Pack or security update, please contact
| > > Microsoft Product Support Services:
| > > http://support.microsoft.com
| > > If the problem can be shown to have been caused by a
| > > security update, then there is usually no charge for the call.
| > > ==============================================
| > >
| > > | > >> this post is going to be a bit long but lots of code so sorry about that. My
| > >> problem is that I have a an asp page that has lots of includes. But I needed
| > >> to have a way to include certain files based on a condition. I came across
| > >> conditional SSI. I created the myprofile page below which has the
| > >> coniditional SSI. When I run the page i get a an expected END error on the
| > >> included member.asp page also below. Not sure what the problem is because its
| > >> on line 45 and there is only a response.write there and only one if statement
| > >> on the entire page. I would appreciate any help on getting this resolved.
| > >> Thanks
| > >>
| > >> '********* myprofile.asp *************
| > >>
| > >> <!--#include file="includes/verify.asp" -->
| > >> <!--#include file="includes/functions.asp" -->
| > >> <!--#include file="includes/header.asp" -->
| > >> <!--#include file="includes/navigation.asp" -->
| > >> <%
| > >> On Error Resume Next
| > >> Call OpenDB()
| > >> '*****////////// Recordsets /////////////************************
| > >> GetTeamSQL = "Select * from tblteams where TeamMembers ='" & strusername & "'"
| > >> Set rsGetTeam = dbConn.Execute(GetTeamSQL)
| > >> ProfileSQL = "Select * from tblmembers where UserName ='" & strusername & "'"
| > >> Set rsProfile = dbConn.Execute(ProfileSQL)
| > >> ListTeamsSQL = "Select DISTINCT Team from tblteams"
| > >> Set rsListTeams = dbConn.Execute(ListTeamsSQL)
| > >> '*****////////// END Recordsets /////////////************************
| > >>
| > >>
| > >> '****////////// SCRIPT FOR CONFIRMING MEMBERS - CAPTAINS ONLY
| > >> ///////////////////***********
| > >> If Request.form("confirm") <> "" OR IsNull(Request.form("confirm")) Then
| > >> struser = Request.form("form_username")
| > >> If Request.form("confirm") = "Confirm" Then
| > >> confirmSQL = "Update tblteams set Active = True WHERE TeamMembers ='" &
| > >> struser & "'"
| > >> Set rsconfirm = dbConn.Execute(confirmSQL)
| > >> Elseif Request.form("confirm") = "Remove" Then
| > >> DeleteSQL = "Delete from tblteams WHERE TeamMembers ='" & struser & "'"
| > >> Set rsDelete = dbConn.Execute(DeleteSQL)
| > >> End IF
| > >> If IsObject(FORMDATA) = True Then
| > >> FORMDATA.RemoveAll 'Clear the form values
| > >> End IF
| > >> End IF
| > >>
| > >> '****//////////// END OF CONFIRM MEMBER SCRIPT
| > >> /////////////////////*******************
| > >>
| > >> 'set a level of membership for the user on the team
| > >> If rsGetTeam.eof Then
| > >> Response.redirect("myprofile.asp?level=freeagent")
| > >> ElseIf rsGetTeam("Captain")= True Then
| > >> Response.redirect("myprofile.asp?level=Captain")
| > >> ElseIf rsGetTeam("CoCaptain") = True Then
| > >> response.redirect("myprofile.asp?level=CoCaptain")
| > >> ElseIf rsGetTeam("Active") = False Then
| > >> response.redirect("myprofile.asp?level=Pending")
| > >> Else
| > >> response.redirect("myprofile.asp?level=member")
| > >> End If
| > >> %>
| > >> '*********conditional SSI *************************
| > >> <!--#if expr="${QUERY_STRING} = /level=freeagent/" -->
| > >> <!--#include file="includes/freeagent.asp" -->
| > >> <!--#elif expr="${QUERY_STRING} = /level=captain/" -->
| > >> <!--#include file="includes/captain.asp" -->
| > >> <!--#elif expr="${QUERY_STRING} = /level=cocaptain/" -->
| > >> <!--#include file="includes/cocaptain.asp" -->
| > >> <!--#elif expr="${QUERY_STRING} = /level=pending/" -->
| > >> <!--#include file="includes/pending.asp" -->
| > >> <!--#elif expr="${QUERY_STRING} = /level=member/" -->
| > >> <!--#include file="includes/member.asp" -->
| > >> <!--#endif -->
| > >>
| > >> <!--#include file="includes/footer.asp" -->
| > >>
| > >> '********member.asp*************
| > >> <table width="100%" border="0" cellpadding="3">
| > >> <tr>
| > >> <td colspan="3"><div align="center">Profile: <%=strusername%></div></td>
| > >> </tr>
| > >> <tr>
| > >> <td width="19%"><div align="right">Team:</div></td>
| > >> <td width="41%"><%=rsGetTeam("Team")%></td>
| > >> <td width="40%"><div align="center">Team
| > >> Members(<%=CountTeamMembers(rsGetTeam("Team"))%>)</div></td>
| > >> </tr>
| > >> <tr>
| > >> <td><div align="right">Motto:</div></td>
| > >> <td><%=rsGetTeam("Motto")%>
| > >> <td rowspan="8" valign="top"><p align="center">::: Cornfirmed :::</p>
| > >> <p>
| > >> <%
| > >> If not rsCountTeamMembers.eof Then
| > >> While Not rsCountTeamMembers.eof
| > >> Response.Write(rsCountTeamMembers("TeamMembers") + "<br>")
| > >> rsCountTeamMembers.movenext
| > >> WEND
| > >> End If
| > >> %>
| > >> </p>
| > >> <p align="center"> </p>
| > >> <p align="center"> </p></td>
| > >> </tr>
| > >> <tr>
| > >> <td><div align="right">Description:</div></td>
| > >> <td><%=rsGetTeam("Description")%></td>
| > >> </tr>
| > >> <tr>
| > >> <td> </td>
| > >> <td> </td>
| > >> </tr>
| > >> <tr>
| > >> <td><div align="right">Name:</div></td>
| > >> <td><%=rsProfile("First") & " " & rsProfile("Last")%></td>
| > >> </tr>
| > >> <tr>
| > >> <td><div align="right">XBox Live Tag:</div></td>
| > >> <td><%=strusername%></td>
| > >> </tr>
| > >> <tr>
| > >> <td><div align="right">E-mail:</div></td>
| > >> '************line 45 ********************
| > >> <td><%=rsProfile("Email")%></td>
| > >> </tr>
| > >> <tr>
| > >> <td> </td>
| > >> <td>
| > >> </tr>
| > >> <tr>
| > >> <td> </td>
| > >> <td>
| > >> </tr>
| > >> </table>
| > >>
| > >>
| > >
| > >
| >
| >
| >
 

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

Top