Displaying Incorrect Login

March 27, 2003 by Mike Peters

Hi Albert, hopefully this will help you out.

What you need to do is create your basic LOGIN SB and then modify the code very slightly.  What your going to do is remove the line of code that redirects the user after the click your button.  Instead, you want to say if their username is wrong, I want to display a message.

Locate this line: Response.Redirect(MM_redirectLoginFailed)

1. Comment it out by putting a ' right before it.

2. Add this line after the above line: Session("loginfailed") = Session("MM_Username")

Next you will want to locate where you have created your text fields and what not for your login form and insert the code where you want the incorrect login message to appear.

1. Add this code:

<%
If Request.Form("submit") = "LOGIN" Then
If Session("loginfailed") = "" Then
Response.Write("Please try again.  Your username or password was incorrect.")
End If
End If
%>

This is probably not the most effecient way to do this but it has worked for me without ever any problems.

Very simple.

June 23, 2003 by marc-antoine carrier

First, you need to make the difference between your loggued users and the others.  A condition set to TRUE can create for you a session variable. for exemple :

if (login == "successfull") Session("loggued")= true

When you come to your loggin page, call that Session variable. 

if (Session("loggued") != true) Response.Write("Your loggin informations are incorrect.  Please, try again.")

Redirect with query

February 17, 2004 by Simon Martin

If you set your failed login as (MM_redirectLoginFailed="login.asp?err=1") and on your login page set up a conditional display something like

<% If Request.QueryString("err") = "1" Then %>
You have not logged in successfully. Please try again       
<% End If %>

Hope this helps