bonjour,
svp j essaye de créer une page connexion et normalement si le matricule et mot de passe sont juste je dois être dirigé vers une autre page "default.aspx" mais c'est pas le cas voila mon code :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data.Sql;
using System.Data.SqlTypes;
using System.Security.Principal;
using System.Data;
using System.Web.Services.Description;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
public partial class authentification : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\nouass\Documents\Visual Studio 2010\WebSites\pfe\App_Data\WRKFLOW.mdf;Integrated Security=True;User Instance=True");
try
{
SqlCommand cmd = new SqlCommand("select mat-sal,mot-pass from liste-sal where mat-sal='"+TextBox2.Text+"'and mot-pass='"+TextBox1.Text+"'",con);
con.Open();
cmd = ExecuteNonQuery(con);
DataSet ds=new DataSet ();
SqlDataAdapter da=new SqlDataAdapter(cmd);
da.Fill(ds, "liste-sal");
DataRow dro;
dro=ds.Tables["liste-sal"].Rows[0];
if ((TextBox2.Text == dro["mat-sal"].ToString()) || (TextBox1.Text == dro["mot-pass"].ToString()))
{
Server.Transfer("default.aspx");
}
else
{
Response.Write("incorrect");
}
}
catch {}
finally
{
con.Close();
}
if (TextBox1.Text.Length < 3)
{
MessageBox.Show("Votre mot de passe ne doit pas contenir moin de 3 caractères", "Error", MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
private void Hide()
{
throw new NotImplementedException();
}
private SqlCommand ExecuteNonQuery(SqlConnection con)
{
throw new NotImplementedException();
}
public SqlCommand End { get; set; }
}
c'est quoi le probleme ???
Partager