Salve, se effettuo il login con user e psw giusti entro nel carrello, ma se opziono il checkbox, mi rimanda alla pagina di errore; il coockie non lo ricevo sul PC!


  • <form method="post" action="login.asp" target="_top">
    <tr>
    <td align="right" height="18" width="250" valign="top">
    <span class="project">user:</span>
    </td>
    <td height="18" width="374" valign="top">
    <input type="text" name="user" id="user" value="user" class="casella" size="20"/>
    </td>
    </tr>
    <tr>
    <td align="right" height="18" width="250" valign="top">
    <span class="project">psw:</span></td>
    <td height="18" width="374" valign="top">
    <input type="password" name="psw" id="psw" value="psw" class="casella" size="20"/>
    <input type="checkbox" name="MyCheckBox" value="yes"><tr>
    <td height="35" width="624" colspan="2" align="center" valign="bottom">
    <input type="submit" id="submit1" value="Invia" name="Invia" class="formbutton" />
    </td>
    </form>

  • pagina dopo il form

    <%

    user = Request.Form("user")
    psw = Request.Form("psw")
    MyCheckBox = Request.Form("MyCheckBox")

    strConn = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = " & _
    Server.MapPath("/mdb-database/My-db.mdb")

    Set conn = Server.CreateObject("ADODB.Connection")
    conn.Open strConn


    sSql= " SELECT utenti.User, Utenti.Psw, Utenti.Nome, Utenti.ID, Utenti.Cognome"
    sSql=sSql & " FROM Utenti"
    sSql=sSql & " WHERE Utenti.User = '" & user & "' AND Utenti.Psw = '" & psw & "'"


    Set rs = Server.CreateObject("ADODB.Recordset")
    Set rs = Conn.Execute(sSql)

    response.write user & "
    "
    response.write psw & "
    "
    response.write MyCheckBox

    If Not Rs.EOF Then
    autenticazione = True
    Else
    autenticazione =False
    End If
    Rs.Close

    if autenticazione = true and MyCheckBox = "Yes" then
    response.cookies("SalvaLogin").expires = DateSerial(2010,5,15)
    response.cookies("SalvaLogin")("user")=user
    response.cookies("SalvaLogin")("psw")=psw

    Response.Redirect("carrello.asp")
    else
    if autenticazione = true and MyCheckBox = "" then
    Session("Admin") = True
    Response.Redirect("carrello.asp")
    else
    Response.Redirect("errorlogin.asp?myCheckBox='" & MyCheckBox & "'")
    end if
    End if
    %>