I have the following code that works great in DEV because the DEV server is on the domain. However when I deploy the files to the web server (not on the domain), my page does not work. Do I put the connection for active directory in the web.config file, or does it get embedded into the c# (sorry, I am new to web development)?
public partial class SupportRequestSA : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)
//I tried this with both lines below, I could not get either to work. The Sys Admins created a user named "MyDomain\adquery" for me
DirectoryEntry group = new DirectoryEntry("LDAP://CN=CSR Admins,OU=ServiceAccounts,DC=MyDomain,DC=COM");
//DirectoryEntry group = new DirectoryEntry("LDAP://CN=CSR Admins,OU=ServiceAccounts,DC=MyDomain,DC=COM", "MyDomain\adquery", "password123456");
ArrayList ArrUsers = new ArrayList();
object members = group.Invoke("Members", null);
foreach (object member in (IEnumerable)members)
DirectoryEntry x = new DirectoryEntry(member);
//ArrUsers.Add(x.Name.Replace("CN=", "")) ;
DropDownList3.DataSource = ArrUsers;
My goal is have the web page build a drop down list from all the users in an AD group....please help....