Précédent   Forum des professionnels en informatique > Webmasters - Développement Web > Langages serveur > ASP
ASP Forum sur la programmation ASP. Avant de poster : Cours ASP, FAQ ASP
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 20/07/2007, 10h41   #1
Membre du Club
 
Inscription : décembre 2006
Messages : 83
Détails du profil
Informations forums :
Inscription : décembre 2006
Messages : 83
Points : 57
Points : 57
Par défaut Prob Identification via base access

Bonjour J'utilise une page pour m'authentifier à une base access. J'utilise un formulaire login / password en methode POST

Lorsque j'essai de m'identifier, le serveur me répond HTTP 500 qui caractérise une erreur de programmation....

voici le code de mon script de validation

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
 
<%
Response.Buffer=true
 
'Ces trois lignes de code nous assure que la page n'est pas dans le cache du client.
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1
 
Dim userid
Dim Pwd
'Assign the UserID, which the user supplies, to this variable.
userid= Request.Form("UID")
'Check whether userid is an empty string. If it is empty, redirect to identification.asp.
'If it is not empty, connect to the database, and validate the user.
 
if userid <> "" then
    pwd = Request.Form("passwd")
 
    Dim Cn
    Dim Rs
 
'Specify the connection string to access the database.
'Remember to change the following connection string parameters to reflect the correct values
'for your SQL server.
 
Ouverture de la BD
	Set Cn = Server.CreateObject("ADODB.connection")
	Cn.Open "Driver={Microsoft Access Driver (*.mdb)};"&_
	"DBQ=\\MaBase.mdb;"
 
	Set Rs= Server.CreateObject("ADODB.recordset")
	Rs.open "Select * from L050_CONTACT_TEST where ""Login"" ='" & userid & "'",Cn
 
    	'Check to see if this userID exists in your database.
    If Not Rs.EOF then
        If strcomp( pwd, Rs.Fields("Password").value , 1) = 0 then
'Password is correct. Set a session variable, and redirect the user to a Default.asp page
'or the main page in your application.
            Session("UID") = userid
            Response.Redirect "Cbon.htm"
            Response.End
        Else
'Password is incorrect. Redirect the user to the logon page.
            Response.Redirect "identificationExtranet.asp"
            Response.End
        End if
    Else
'If the user is not in your database, point him or her to the Register.asp page
'so that he or she can register at your Web site.
        Response.Redirect "identificationExtranet.asp"
        Response.End
    End if
Else
    Response.Redirect "identificationExtranet.asp"
    Response.End
End if
 
%><head><title>Page de validation</title></head>
J'ai cherché dans ce forum et trouvé la même méthode de connexion...
Pouvez vous me dire là ou j'ai tout faux..
Merci
nico_pouchet est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 20/07/2007, 13h09   #2
Membre du Club
 
Inscription : décembre 2006
Messages : 83
Détails du profil
Informations forums :
Inscription : décembre 2006
Messages : 83
Points : 57
Points : 57
Bon j'ai continué mes recherches et en utilisant le code avec une base SQl, il n'y a pas de problèmes, ça marche.
Il n'y a qu'avec la base access que ça ne marche pas et j'ai abosluement besoin d'utiliser cette base.

Je me demande si cela ne vient pas du serveur IIS à qui il manquerai peut etre une dll en reference , je ne sais pas.

Quelqu' un a une idée ?

Nico

MAJ

J'ai testé en mettant le fichier access en local sur le serveur, me disant que c'est peut être un problème de droit ... mais ca ne marche toujours pas...
nico_pouchet est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 20/07/2007, 14h16   #3
Modérateur
 
Avatar de roro06
 
Inscription : avril 2007
Messages : 1 364
Détails du profil
Informations personnelles :
Âge : 42

Informations forums :
Inscription : avril 2007
Messages : 1 364
Points : 1 551
Points : 1 551
Bonjour

Je vois deux choses qui peuvent être ton pb :
Code :
    Cn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("MaBase.mdb")
et également : enleve les double "" :
Code :
Rs.open "Select * from L050_CONTACT_TEST where Login ='" & userid & "'",Cn
roro06 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 20/07/2007, 14h39   #4
Membre du Club
 
Inscription : décembre 2006
Messages : 83
Détails du profil
Informations forums :
Inscription : décembre 2006
Messages : 83
Points : 57
Points : 57
Merci bcp!!!!!!!!!!!!!!!!!!!!!
ça marche .....!!!!!!!!!!!!!!!!!! niquel merci

voici le code final dès fois que ça interesse quelqu'un

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
 
<%
Response.Buffer=true
 
'Ces trois lignes de code nous assure que la page n'est pas dans le cache du client.
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1
 
Dim userid
Dim Pwd
'Assign the UserID, which the user supplies, to this variable.
userid= Request.Form("UID")
'Check whether userid is an empty string. If it is empty, redirect to identification.asp.
'If it is not empty, connect to the database, and validate the user.
 
if userid <> "" then
    pwd = Request.Form("passwd")
 
    Dim Cn
    Dim Rs
    Dim StrConnect
 
'Specify the connection string to access the database.
'Remember to change the following connection string parameters to reflect the correct values
'for your SQL server.
    Set Cn = Server.CreateObject("ADODB.connection")
    Cn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("Base_Ref.mdb") 
    Set Rs = Server.CreateObject("ADODB.Recordset")
    Rs.open "Select * from L050_CONTACT_TEST where Login ='" & userid & "'",Cn
    'Check to see if this userID exists in your database.
    If Not Rs.EOF then
        If strcomp( pwd, Rs.Fields("password").value , 1) = 0 then
'Password is correct. Set a session variable, and redirect the user to a Default.asp page
'or the main page in your application.
            Session("UID") = userid
            Response.Redirect "Cbon.htm"
            Response.End
        Else
'Password is incorrect. Redirect the user to the logon page.
            Response.Redirect "identificationExtranet.asp"
            Response.End
        End if
    Else
'If the user is not in your database, point him or her to the Register.asp page
'so that he or she can register at your Web site.
        Response.Redirect "identificationExtranet.asp"
        Response.End
    End if
Else
    Response.Redirect "identificationExtranet.asp"
    Response.End
End if
 
%><head><title>Page de validation</title></head>
Encore merci tu me sauves la vie là
nico_pouchet est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 04h01.


 
 
 
 
Partenaires

Hébergement Web