Forum Moderators: open

Message Too Old, No Replies

Help. ASP Newbie completely perplexed.

         

liquidstar

9:12 pm on Mar 23, 2002 (gmt 0)

10+ Year Member



I cannot for the life of me figure out what is wrong. Just a quick overview. I'm very new to ASP. I'm using a hosted account on Windows 2000 server with IIS 5. Here is my quandry. Any time I'm trying If... Then Statements I'm getting a 500 Internal Server Error. Here is some (what I thought) simple code:

<% Option Explicit %>
<html>
<%
Dim Dice1, Dice 2, Total

Randomize
Dice1 = Int(Rnd *6) + 1
Dice2 = Int(Rnd *6) + 1

Total = Dice1 + Dice2
%>
<% If Dice1 = 1 And Dice2 = 1 Then %>
Snake Eyes<p>
<% ElseIf Dice1 6 And Dice2 = 6 Then %>
Box Cars<p>
<% ElseIf Total = 7 Then %>
Lucky Number 7!<p>
<% ElseIf Total = 11 Then %>
11, Nice Craps roll.<p>
<% Else %>
Dice 1: <% = Dice1 %><p>
Dice 2: <% = Dice2 %><p>
Total: <%Total %><p>
<% End If %>
</html>

Is it me, or is it the machine that's scewing up? Please help, as I'm really starting to feel like an idiot.

bmcgee

9:59 pm on Mar 23, 2002 (gmt 0)

10+ Year Member



Look at the first ElseIf statement...you are missing an "=" in the comparison.

Crazy_Fool

10:01 pm on Mar 23, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



hi liquidstar and welcome to WmW

first step will be to turn off the "friendly" error messages (the http 500 errors) in your browser.
look in tools -> internet options -> advanced for "show friendly http error messages". once turned off you should see proper ASP error messages which should give you a clue.

bmcgee

10:02 pm on Mar 23, 2002 (gmt 0)

10+ Year Member



By the way, here's a tip for debugging your ASP code. If you are using IE, you may get generic errors. Do this to ensure you get a more descript error spit back from the browser...it will likely give you a line number and a more accurate description of the error:

Go to Tools ¦ Internet Options
Click Advanced tab
Find the "Show friendly HTTP error messages" setting.

Now, I don't remember if you turn it on or off...but you'll figure that out by trial and error. I think you turn it ON (but I checked mine and it is off..hmmmm).

liquidstar

10:12 pm on Mar 23, 2002 (gmt 0)

10+ Year Member



thank you guys so much!

brotherhood of LAN

11:29 pm on Mar 23, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



RE crazy fool

Thanks for that tip, its gonna be useful with my trial and error approach :)