login prob

Results 1 to 2 of 2

Thread: login prob

  1. #1
    Join Date
    Dec 1969

    Default login prob

    hi<BR> my problem is fairly simple but needs help as i m quite new to the world of asp.i have one login form wherin i require that if user type a wrong password then he must get a message that he has enter a wrong password and he must be redirected to the login page.for that i have given response.buffer=true and even take care that it is the first line. and then writeen response.redirect but then also it is giving error.<BR>&#060;script language="VBScript" "Runat=Server"&#062;<BR> &#060;%<BR> name=request.form("lname")<BR> passwrd=request.form("password")<BR> Set rs=Server.CreateObject("ADODB.Recordset") <BR> Set rs1=Server.CreateObject("ADODB.Recordset")<BR> Set conn=Server.CreateObject("ADODB.Connection")<BR> conn.open="DSN=temp1;UID=scott;Pwd=tiger"<BR> set rs=conn.execute("Select * from register")<BR> strsql="Select name,pswd from register where name like &#039;"& name &"&#039; and pswd= &#039;"& passwrd &"&#039; "<BR> <BR> rs1.open strsql,conn<BR> <BR> if rs1.eof then<BR> response.write("Invalid password please try again")<BR> &#039;response.redirect "http://nafisa/numenwebsite/1234/loginfrm.asp"<BR> <BR> else<BR> response.write(rs1.fields(1))<BR> response.write(pswd)<BR> end if<BR>%&#062;<BR>if any one can caught any sort of error at glance pls help me out<BR> thanks in advance.<BR> nafisa

  2. #2
    Join Date
    Dec 1969

    Default RE: login prob

    You can&#039;t have any output on a page when calling response.redirect Get rid of the Repsonse.Wrtie("Invalid....")<BR>and just redirect to the login page, you could pass a value in the querystring so that you know that the user has previously entered a invalid username.<BR><BR>response.redirect "loginfrm.asp?error=1"<BR><BR>Then on the loginfrm.asp just use an if statement<BR><BR>If Request.Querystring("error") = 1 then<BR>Response.Write("Invalid username")<BR>End if<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts