Hi there,
I was on holidays for a while, so I haven't been able to respond earlier.
The Session variable solution that Omer has presented works pretty well, but IMO it has one minor drawback. If you use this mechanism on other pages than the login page, you might end up with an incorrect error message somewhere (suppose the user moves away from login.asp and goes to another page that is also capable of displaying an error message).
I think it's better to use a local variable, instead of a Session variable. The code that Dreamweaver has generated for you redirects the user away from
login.asp back to
login.asp. So, even if you are still viewing the same page, you lost all local information. This makes it impossible to use the Recordset's
EOF property to determine whether logging in failed. Fortunately, a
QueryString variable,
accessdenied, is passed as well so you can use that one to determine whether you need to display the error message or not:
Code:
Dim sErrorMessage
If Len(Request.QueryString("accessdenied")) > 0 Then
sErrorMessage = "<br>Login Failed. Please try again"
End If
and then in the page:
Code:
Please type your Username and Password, then click the
Login button:<%=sErrorMessage%>
This way, the error message is only displayed after the user has been redirected to the login.asp page which you can find out by checking the
accessdenied QueryString variable.
HtH,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.