Bonjour a tous je tient a vous dire que je suis encore debutant en Asp.net !

Voila , J'aimerais savoir comment faire pour que le controle authentification Asp n'utilise plus la base de donnée par defaut qu'il créé "ASPNETDB.MDF"
mais une base donnée utilisé par mon entreprise .

J'ai trouvé ce code que je trouve correcte mais qui ne fonctionne malheuresement pas (apprement le formulaire cherche toujours les utilisateurs dans la base de donnée qu'il crée)

Voila le code :

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
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
60
61
 
 
protected void Page_Load(object sender, EventArgs e)
        {
            // Check if the user is already loged in or not
            if ((Session["Check"] != null) && (Convert.ToBoolean(Session["Check"]) == true))
            {
                // If User is Authenticated then moved to a main page
                if (User.Identity.IsAuthenticated)
                    Response.Redirect("home.aspx");
            }
        }
 
        protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
        {
            Boolean blnresult;
            blnresult = false;
 
            // Pass UserName  and Password from login1 control to an authentication function 
            //which will check the user name and password from sql server.
            // Then will retrun a true or false value into blnresult variable
            blnresult = Authentication(Login1.UserName, Login1.Password);
 
            // If blnresult has a true value then authenticate user 
            if (blnresult == true)
            {
                // This is the actual statement which will authenticate the user
                e.Authenticated = true;
                // Store your authentication mode in session variable 
                Session["Check"] = true;
            }
            else
                // If user faild to provide valid user name and password
                e.Authenticated = false;
        }
 
 
        // Function name Authentication which will get check the user_name and passwrod from sql database then return a value true or false
        protected static Boolean Authentication(string username, string password)
        {
            string sqlstring;
            sqlstring = "Select mail,pw from [utilisateurs] where mail='" + username + "' and pw ='" + password + "'";
 
            // create a connection with sqldatabase 
            SqlConnection con = ConnectionManager.Seconnecter();
 
            // create a sql command which will user connection string and your select statement string 
            SqlCommand comm = new SqlCommand(sqlstring, con);
 
            // create a sqldatabase reader which will execute the above command to get the values from sqldatabase
            SqlDataReader reader;
 
            // execute sql command and store a return values in reade
            reader = comm.ExecuteReader();
 
            // check if reader has any value then return true otherwise return false
            if (reader.Read())
                return true;
            else
                return false;
        }

Note :
"ConnectionManager" est une classe que j'utilise dans mon application et "seConnecter()" est une methode qui me permet de me connecter a ma base de donnée .