Last post May 20, 2008 12:37 AM by parth_192
May 16, 2008 05:47 AM|parth_192|LINK
In my application I want login for active directory users. i have made and it is work but when i published it and then try to run it..at that time it gives me error that User name or password is not valid ...though it is working when i run it using visual
studio 2005 ..
please some one help me out...its urget..
Thanks in Advanced,
May 16, 2008 08:13 AM|johram|LINK
Please read Ryan Dunn's FAQ Common System.DirectoryServices Issues and Solutions
I bet my friday beer that it has to do with your credentials. Running locally, you're verifying the account with your own (domain) user, while after having published the web to IIS, you will run with a local ASP.NET account (which has no AD access).
May 16, 2008 10:12 AM|johram|LINK
Does this mean that the beer is still mine? [cool] Cheers!
May 16, 2008 11:42 AM|parth_192|LINK
hahhaa....ya sure beer is only for you....
Now i want to know that which parameter should i set...I mean can you give some sample code from that i can get idea ...
your help is appreaciated...
May 16, 2008 11:50 AM|parth_192|LINK
Below is the code which i have used just for your reference.....plz give me some idea..or suggest me what changes i need to do . ??
mConnectionString = connection_string
mLdapConnections(Thread.CurrentThread) = oRoot
oRoot.Username = username
oRoot.Password = password
string_value = properties.Properties(pname)(0).ToString()
results = oSearcher.FindAll()
result = results(i)
userdata = result
ldap_user.Roles = GetRolesFromLDAP(ldap_user.distinguishedname)
userdata = results(i)
user_data_table = ReadProperties(userdata)
May 16, 2008 11:12 PM|johram|LINK
The only obvious error I see is that your connection string should be LDAP:// and not LDAP:\\
Also you need to make sure username (that you use in DirectoryEntry) is prefixed with domain, like this: domain\username
May 20, 2008 12:37 AM|parth_192|LINK
Hey Johram...I have a one more question...!!
How can I found out weather a user is a admin or not...currently I am checking ROLE. If Roles contains "Domain Admins" then it means he is admin.
Is it right..or should it other way..of wrong then let me know how can i found admin from AD.