Error with multiple If then, else if
I'm new in ASP development.
This is my source code :
ident = request.Form("ident")
pass=request.Form("passe")
response.write(ident)
response.write(pass)
if pass= "m" and ident="m" Then
Session("connect")="membre"
response.redirect("../")
else if pass= "g" and ident="开发者_运维知识库g" Then
Session("connect")="gest"
response.redirect("../")
else if pass= "a" and ident="a" Then
Session("connect")="admin"
response.redirect("../")
else
response.redirect("ident.asp")
End If
But, with this code, I get this :
"Erreur de compilation Microsoft VBScript error '800a0401'
Fin d'instruction attendue
/iisHelp/common/500-100.asp, line 11
Dim objASPError, blnErrorWritten, strServername, strServerIP, strRemoteIP Dim strMethod, lngPos, datNow, strQueryString, strURL --------------------------------------------------------------------------^
Erreur de compilation Microsoft VBScript error '800a03f6'
'End' attendu
/groupe2/stage23/TP3/verif_id.asp, line 18 "
Else If
in VB must be written in one word, without whitespace separator – ElseIf
.
VBScript Else if Statement
must be elseif
or ElseIf
(without space)
if pass= "m" and ident="m" Then
Session("connect")="membre"
response.redirect("../")
elseif pass= "g" and ident="g" Then
Session("connect")="gest"
response.redirect("../")
elseif pass= "a" and ident="a" Then
Session("connect")="admin"
response.redirect("../")
else
response.redirect("ident.asp")
End If
It looks like earlier in your file -- line 11 -- you've accidentally deleted a newline that's making DIM statements collide. This is throwing the whole file out of synch in the parser.
Split that one line DIM statement into two lines (or kill the second DIM -- your choice) and see if that fixes your problem.
精彩评论