Salve a tutti,
mi sono creato un custom provider.
Ora ho un problemino.
Stavo analizzando un comportamento che io ritengo strano.
Ho un createuserwizard, che sfrutta la funzione di cui io sto facendo l'overriding per inserire i dati nel database:
codice:
Dim conn As New OleDb.OleDbConnection(connStr)
'----perform checking all the relevant checks here
' and set the status of the error accordingly, e.g.:
'status = MembershipCreateStatus.InvalidPassword
'status = MembershipCreateStatus.InvalidAnswer
'status = MembershipCreateStatus.InvalidEmail
'---add the user to the database
Try
conn.Open()
Dim sql As String = "INSERT INTO Membership VALUES (" & _
"@username, @password, @email)"
Dim comm As New OleDb.OleDbCommand(sql, conn)
comm.Parameters.AddWithValue("@username", username)
comm.Parameters.AddWithValue("@password", password)
comm.Parameters.AddWithValue("@email", email)
Dim result As Integer = comm.ExecuteNonQuery()
conn.Close()
status = MembershipCreateStatus.Success
Dim user As New MembershipUser("AccessMembershipProvider", username, Nothing, email, Nothing, Nothing, True, False, Now, Nothing, Nothing, Nothing, Nothing)
Return user
Catch ex As Exception
'---failed; determine the reason why
status = MembershipCreateStatus.UserRejected
Return Nothing
End Try
La cosa che non mi convince è questo Return user alla fine.
Infatti appena effettuo dal sito la registrazione di un nuovo utente, quest'ultimo si autentica automaticamente e credo che sia colpa proprio di questo return user. Ma ciò è proprio quello che io non voglio che accada!
Dopo che l'utente si è registrato, vorrei che egli debba inserire i dati da un form login e non che l'autenticazione avvenga automaticamente!
Come posso risolvere il problema?!?
La causa è proprio questo return user o vi è un'altra spiegazione?
Spero nei vostri aiuti.
Grazie mille.
tranky