Hello,
It seem's that I'm not alone with my problems ;-)
For me the error is............ :
03/07/2007 16:16:53.42 w3wp.exe (0x0F20) 0x064C Windows SharePoint Services General 72e9 Medium Error in resolving user 'cgrisantv' : System.NullReferenceException: Object reference not set to an instance of an object. at LMSP.LDAPMemberShipProvider.GetUser(String username, Boolean userIsOnline) at Microsoft.SharePoint.Utilities.SPMembershipProviderPrincipalResolver.ResolvePrincipal(String input, Boolean inputIsEmailOnly, SPPrincipalType scopes, SPPrincipalSource sources, SPUserCollection usersContainer) at Microsoft.SharePoint.Utilities.SPUtility.ResolvePrincipalInternal(SPWeb web, SPWebApplication webApp, Nullable`1 urlZone, String input, SPPrincipalType scopes, SPPrincipalSource sources, SPUserCollection usersContainer, Boolean inputIsEmailOnly, Boolean alwaysAddWindowsResolver).
03/07/2007 16:16:53.43 w3wp.exe (0x0F20) 0x064C Windows SharePoint Services General 72e7 Medium Error in searching user 'cgrisantv' : System.NullReferenceException: Object reference not set to an instance of an object. at LMSP.LDAPMemberShipProvider.GetUser(String username, Boolean userIsOnline) at Microsoft.SharePoint.Utilities.SPMembershipProviderPrincipalResolver.ResolvePrincipal(String input, Boolean inputIsEmailOnly, SPPrincipalType scopes, SPPrincipalSource sources, SPUserCollection usersContainer) at Microsoft.SharePoint.Utilities.SPMembershipProviderPrincipalResolver.SearchPrincipals(String input, SPPrincipalType scopes, SPPrincipalSource sources, SPUserCollection usersContainer, Int32 maxCount, Boolean& bReachMaxCount) at Microsoft.SharePoint.Utilities.SPUtility.SearchPrincipalFromResolvers(List`1 resolvers, String input, SPPrincipalType scopes, SPPrincipalSo...
03/07/2007 16:16:53.43* w3wp.exe (0x0F20) 0x064C Windows SharePoint Services General 72e7 Medium ...urce sources, SPUserCollection usersContainer, Int32 maxCount, Boolean& reachMaxCount, Dictionary`2 usersDict).
I tested the method getUser separately and it don't return a nullpointer exception...
I can say that the mapping in the web.conf is correct, the assembly loads correctly and the provider is good declared, (I corrected a lot of errors with the logs ;-) )
For me the problem is in the way I writed my MembershipProvider :
1 using System;
2 using System.Collections.Specialized;
3 using System.Web.Security;
4 using System.Data.SqlClient;
5 using System.Collections.Generic;
6 using System.Text;
7
8 namespace LMSP
9 {
10 public class LDAPMemberShipProvider : MembershipProvider
11 {
12 private string _applicationName;
13 private string _connectionStringName;
14 private string _name;
15 //private string connectionString="Data Source=EIFRMOSS02;Initial Catalog=custom_identification;Integrated Security=True";
16 public LDAPMemberShipProvider()
17 {
18 //
19 // TODO: Add constructor logic here
20 //
21 }
22
23
24 // MembershipProvider Properties
25 public override string ApplicationName
26 {
27 get { return _applicationName; }
28 set { _applicationName = value; }
29 }
30
31
32 public override void Initialize(string name,
33 NameValueCollection config)
34 {
35 if (config == null)
36 throw new ArgumentNullException();
37 _applicationName = config["applicationName"];
38 _connectionStringName = config["connectionStringName"];
39 _name = name;
40
41 base.Initialize(name, config);
42 }
43
44 public override bool EnablePasswordRetrieval
45 {
46 get { return false; }
47 }
48
49 public override bool EnablePasswordReset
50 {
51 get { return false; }
52 }
53
54 public override int MaxInvalidPasswordAttempts
55 {
56 get { throw new NotSupportedException(); }
57 }
58
59 public override int MinRequiredNonAlphanumericCharacters
60 {
61 get { throw new NotSupportedException(); }
62 }
63
64 public override int MinRequiredPasswordLength
65 {
66 get { throw new NotSupportedException(); }
67 }
68
69 public override int PasswordAttemptWindow
70 {
71 get { throw new NotSupportedException(); }
72 }
73
74 public override MembershipPasswordFormat PasswordFormat
75 {
76 get { throw new NotSupportedException(); }
77 }
78
79 public override string PasswordStrengthRegularExpression
80 {
81 get { throw new NotSupportedException(); }
82 }
83
84 public override bool RequiresQuestionAndAnswer
85 {
86 get { throw new NotSupportedException(); }
87 }
88
89 public override bool RequiresUniqueEmail
90 {
91 get { throw new NotSupportedException(); }
92 }
93
94 public override MembershipUser CreateUser(string username,
95 string password, string email, string passwordQuestion,
96 string passwordAnswer, bool isApproved, object providerUserKey,
97 out MembershipCreateStatus status)
98 {
99 throw new NotSupportedException();
100 }
101
102 public override bool ChangePasswordQuestionAndAnswer
103 (string username, string password,
104 string newPasswordQuestion, string newPasswordAnswer)
105 {
106 throw new NotSupportedException();
107 }
108
109 public override string GetPassword(string username,
110 string answer)
111 {
112 throw new NotSupportedException();
113 }
114
115 public override bool ChangePassword(string username,
116 string oldPassword, string newPassword)
117 {
118 throw new NotSupportedException();
119 }
120
121 public override string ResetPassword(string username,
122 string answer)
123 {
124 throw new NotSupportedException();
125 }
126
127 public override void UpdateUser(MembershipUser user)
128 {
129 throw new NotSupportedException();
130 }
131
132 public override bool ValidateUser(string username,
133 string password)
134 {
135 // je crée la connexion de mon serveur ainsi que la base de données concernée
136 SqlConnection databaseConnexion = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings[_connectionStringName].ConnectionString);
137 //SqlConnection databaseConnexion = new SqlConnection(connectionString);
138
139 // je crée maintenant une requête de selection qui permettra d'afficher les valeurs souhaités...
140 SqlCommand databaseCommand = new SqlCommand("SELECT password FROM T_Identification WHERE login='" + username + "'", databaseConnexion);
141
142 // Là j'ouvre la connexion Sql
143 databaseConnexion.Open();
144
145 // Et je définie une datareader...
146 SqlDataReader dr = databaseCommand.ExecuteReader();
147
148 if (dr == null) return false;
149
150 if (!dr.Read()) return false;
151
152 if (dr["password"] != null && dr["password"].Equals(password))
153 {
154 return true;
155 }
156 else
157 {
158 return false;
159 }
160 }
161
162 public override bool UnlockUser(string userName)
163 {
164 throw new NotSupportedException();
165 }
166
167 public override MembershipUser GetUser(object providerUserKey,
168 bool userIsOnline)
169 {
170 /*SqlConnection databaseConnexion = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings[_connectionStringName].ConnectionString);
171 //SqlConnection databaseConnexion = new SqlConnection(connectionString);
172 SqlCommand databaseCommand = new SqlCommand("SELECT ID_Login,login,email FROM T_Identification WHERE ID_LOGIN=" + providerUserKey.ToString(), databaseConnexion);
173 databaseConnexion.Open();
174
175 // Et je définis un datareader...
176 SqlDataReader dr = databaseCommand.ExecuteReader();
177 if (dr == null) return null;
178 MembershipUser user = null;
179 while (dr.Read())
180 {
181 user = new MembershipUser(_name, dr["login"].ToString(), dr["ID_Login"], dr["email"].ToString(), "", "", true, false, DateTime.Now, DateTime.Now, DateTime.Now, DateTime.Now, DateTime.Now);
182 }
183 return user;*/
184 throw new NotSupportedException();
185 }
186
187 public override MembershipUser GetUser(string username,
188 bool userIsOnline)
189 {
190 SqlConnection databaseConnexion = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings[_connectionStringName].ConnectionString);
191 //SqlConnection databaseConnexion = new SqlConnection(connectionString);
192 SqlCommand databaseCommand = new SqlCommand("SELECT ID_Login,login,email FROM T_Identification WHERE login='" + username + "'", databaseConnexion);
193 databaseConnexion.Open();
194
195 // Et je définis un datareader...
196 SqlDataReader dr = databaseCommand.ExecuteReader();
197 if (dr == null) return null;
198 MembershipUser user = null;
199 while (dr.Read())
200 {
201 user = new MembershipUser(_name, dr["login"].ToString(), dr["ID_Login"], dr["email"].ToString(), "", "", true, false, DateTime.Now, DateTime.Now, DateTime.Now, DateTime.Now, DateTime.Now);
202 }
203 return user;
204 }
205
206 public override string GetUserNameByEmail(string email)
207 {
208 throw new NotSupportedException();
209 }
210
211
212 public override bool DeleteUser(string username,
213 bool deleteAllRelatedData)
214 {
215 throw new NotSupportedException();
216 }
217
218 public override MembershipUserCollection GetAllUsers
219 (int pageIndex, int pageSize, out int totalRecords)
220 {
221 totalRecords = 0;
222 SqlConnection databaseConnexion = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings[_connectionStringName].ConnectionString);
223 //SqlConnection databaseConnexion = new SqlConnection(connectionString);
224 SqlCommand databaseCommand = new SqlCommand("SELECT ID_Log