bonsoir,
j'ai une méthode d' authentification dans un web service WS_authentification , elle ça marche bien , voici le code si dessouuuuuuuuus(à la fin de ce message); au début elle me retourne toujours false mais quand j'ajoute (true) à [webmethod] il me retourne true (cad l'authentification est effectué)
et dans ma web form d'authentification j'ai le code suivant

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
protectedvoid Page_Load(object sender, EventArgs e)
{
                 WS_authentification aut = newWS_authentification();
                  if (Session["UserNum"] != null)
                                    Response.Redirect("reservation1.aspx");
}
protected void Button1_Click(object sender, EventArgs e)
{
         WS_authentification authentification = newWS_authentification();
          bool res = authentification.authentifier(login.Text, mp.Text);
         if (res == true)
                  Response.Redirect("reservation1.aspx");
}
=>le résultat si je clique sur le bouton "Button1_Click" il m' affiche la page reservation1.aspx

mon problème si j'ajoute à la page reservation1.aspx ce code

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
if (Session["UserNum"] == null)
Response.Redirect("authentification.aspx");
Label1.Text = Session["UserNum"].ToString();
pour entrer à ma sessionet si je clique sur le bouton "Button1_Click" il ne m'affiche pas la page reservation1.aspx et il reste à la page d'authentification

quel est mon erreur??
s'il vous plait aidez moi l'authentification est nécessaire pour mon projet de fin d'étude
merci de votre colaboration

/////////***********////

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
[WebMethod(true)]
public bool authentifier(string login, string mp)
{
System.Data.SqlClient.SqlConnection connexion;
connexion = new System.Data.SqlClient.SqlConnection();
string connectString = "Data Source=STANDARD;"
                                + "Initial Catalog=SejoursHOTEL;"
                                +"User ID=sa;"
                                +"Password=administrateur;";
string strQuery = "select * from T_CLIENT";
connexion.ConnectionString = connectString;
 
System.Data.SqlClient.SqlCommand oCommand = new System.Data.SqlClient.SqlCommand(strQuery, connexion);
connexion.Open();
 
SqlDataReader oReader = oCommand.ExecuteReader();
int b = -1;
bool returnBool = false;
while(oReader.Read())
{
if (oReader[8].ToString() == login && oReader[9].ToString() == mp)
{ 
try { Session["user"] = oReader[0].ToString(); 
returnBool = true; 
} 
catch (Exception e){returnfalse;}
}
} 
oReader.Close();
connexion.Close();
return returnBool;
}