开发者

asp.net role provider- get users email address?

i am using role provider and have it managing users on my intranet via their windo开发者_C百科ws logins. how can i pull their email address and maybe some other user content from asp.net using their user info?

do i need to hook into active directory? a sample fir this would be great if this is the way to go

thanks all


The membership provider is responsible for this, there is an Email property on the MembershipUser class. (Remember that it should work the same irrespective of the provider, SQL or AD)

Check this MSDN article for detailed information


i folks, here is how you can pull any data points from Active Directory. in my code i get the user's email

SELECT mail FROM 'LDAP://DC=Domain,DC=win,DC=ml,dc=COM' WHERE samaccountname = 'userName'

              System.Data.OleDb.OleDbConnection con;
              System.Data.OleDb.OleDbDataAdapter da;
              System.Data.OleDb.OleDbCommand cmd;
              System.Data.DataTable dt = new System.Data.DataTable();

              con = new System.Data.OleDb.OleDbConnection("Provider=ADsDSOObject;dsn=Active Directory Provider");
              con.Open();

              //                Create a command object on this connection

              cmd = new System.Data.OleDb.OleDbCommand(this.tbQuery.Text, con);
              da = new System.Data.OleDb.OleDbDataAdapter();
              da.SelectCommand = cmd;

              try
              {
                    da.Fill(dt);
                    this.dgResults.DataSource = dt;
              }
              catch (System.Data.OleDb.OleDbException exc)
              {
                    MessageBox.Show(exc.Message);
              }
              con.Close();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜