Forums
This topic is locked
Response.write when login fails
Posted 28 Apr 2010 00:03:58
1
has voted
28 Apr 2010 00:03:58 Christian Sen posted:
Hi,I would like to write an error message on logipage when login fails, using response.write, how do I do this?
Thanks for any help!
Replies
Replied 06 May 2010 17:18:57
06 May 2010 17:18:57 MX Addict replied:
Hi Christian,
I create 2 pages:
login.asp and a login_false.asp both pages contain a form with user and password textfield
when using dreamweaver go to User Authentication > Login user
Use this Dreamweaver script on both pages. Only the login.asp redirects to login_false.asp when login failes.
The login_false.asp redirects to itself. On the login_false.asp you can put some text as Login is not Correct.
So someone goes to login.asp. Try to login. If fails redirect to login_fails.asp.
I create 2 pages:
login.asp and a login_false.asp both pages contain a form with user and password textfield
when using dreamweaver go to User Authentication > Login user
Use this Dreamweaver script on both pages. Only the login.asp redirects to login_false.asp when login failes.
The login_false.asp redirects to itself. On the login_false.asp you can put some text as Login is not Correct.
So someone goes to login.asp. Try to login. If fails redirect to login_fails.asp.
Replied 29 Jan 2013 14:48:12
29 Jan 2013 14:48:12 Christian Sen replied:
I don't understand why I didn't thank you for this one!
Late, but here it comes, -thank you
But what if I wanted to apply a response.write to the login page, how would I go about implementing it to the code already set by dreamweaver?
Late, but here it comes, -thank you
But what if I wanted to apply a response.write to the login page, how would I go about implementing it to the code already set by dreamweaver?
Replied 02 Feb 2013 22:34:36
02 Feb 2013 22:34:36 MX Addict replied:
Hi Christian,
You can use session variables for this
You can use session variables for this
<% MM_fldUserAuthorization = "" MM_redirectLoginSuccess = "true.asp" MM_redirectLoginFailed = "default.asp" If Not MM_rsUser.EOF Or Not MM_rsUser.BOF Then ' username and password match - this is a valid user Session("MM_Username") = MM_valUsername Session.Contents.Remove("iCount") If (MM_fldUserAuthorization <> "") Then Session("MM_UserAuthorization") = CStr(MM_rsUser.Fields.Item(MM_fldUserAuthorization).Value) Else Session("MM_UserAuthorization") = "" End If if CStr(Request.QueryString("accessdenied")) <> "" And false Then MM_redirectLoginSuccess = Request.QueryString("accessdenied") End If MM_rsUser.Close Response.Redirect(MM_redirectLoginSuccess) End If MM_rsUser.Close Session("iCount") = Session("iCount") + 1 Response.Redirect(MM_redirectLoginFailed) End If %>
<body> <form name="form1" method="POST" action="<%=MM_ LoginAction%>"> <label for="user"></label> <input type="text" name="user" id="user"> <label for="password"></label> <input type="text" name="password" id="password"> <input type="submit" name="button" id="button" value="Submit"> </form> <%If Session("iCount") >= 1 Then %><div>Your login failed <%= Session("iCount")%> times.</div><%End If%> </body>
Replied 06 Feb 2013 18:19:49
06 Feb 2013 18:19:49 Christian Sen replied:
Thank you for responding and helping me out, again
Tried out your suggestion and it did the trick, just what I was looking for!
Regards,
Christian
Tried out your suggestion and it did the trick, just what I was looking for!
Regards,
Christian