Bob Schneider
asked on
Mysterious Classic ASP Error
I am getting this error when I load a page this page: http://www.gtraxc.com/pages/results/results.asp
The problem is that there seems to be nothing wrong anywhere near Line 2. These are the first three lines...:
I can't find any unterminated "If" statements. Any help would be much appreciated.
LineNumber 2
ErrorCode 800a03f6
Description Expected 'End'
The problem is that there seems to be nothing wrong anywhere near Line 2. These are the first three lines...:
<%@ Language=VBScript %>
<%
Option Explicit
I can't find any unterminated "If" statements. Any help would be much appreciated.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Hi folks. I try hard to have readable code, including indenting, and I have been unable to find the issue. The interesting thing is I put a Response.End right after my variable declarations (ie: after Line 2) and it still threw the error, when it really should have rendered a blank page. Does that mean that it could be an include? I do use includes but I use most of the same ones on several pages and this is the only one causing the error. I assume the server processes the server side script first syntax and then other code?
BTW, here are the first two lines again:
Thanks for your help.
BTW, here are the first two lines again:
<%@ Language=VBScript %>
<%
Thanks for your help.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
are you serving your asp pages via IIS?
what if you trying putting the quotes around?
what if you trying putting the quotes around?
<%@ Language="VBScript" %>
ASKER
I'm using iis8 and this syntax works on all pages on multiple sites so I don't think that's the problem. I tend to believe I am missing a simple error but what I don't know why it is rendering so early in the page...hence time to look at both of your suggestions re: includes...but, again, they are includes that I use on other pages as well will no issues. I will keep looking... Thanks!
ASKER
Found it:
<End If%>
(notice the missing "%").
This was near the very bottom of the html. :( Thanks for your help!
<End If%>
(notice the missing "%").
This was near the very bottom of the html. :( Thanks for your help!
Classic ASP is not the easiest to find errors. That is why when I am really stuck, I just start rewriting the code in a new file line by line making sure to indent code and make it look pretty. That's how I find errors like this. If the code is large, take small chunks at a time.
ASKER
I actually did kind of the opposite. I started removing blocks of code until it didn't throw an error...same result basically. I also sometimes step through the code with the Response.End technique that I shared but, as we found out here, that doesn't always work. Thanks again!!!!
In a case like this, one way I troubleshoot is to make sure the code is nested. Go through the code line by line and make sure the nesting is correct. This does not help with the code, just helps you identify the issue.
Open in new window
Open in new window
Looking above, it is easy to spot there is a if without a end if.
If the code is very long, you can start pulling things out and putting them back one by one. But the issue is an unmatched if/end