8
try to access an ldap server from an iis server in a dmz and getting the error message : Information about the domain could not be retrieved (1355). There are articles about appending dns information or using the underlying objects, but these solutions are not working for me so please refrain from google searching and posting the same regurgitated bad advice.
I rewrote the entire layer to use principal objects. That got me a good error message at least.
using System;
using System.Collections;
using System.Collections.Generic;
using System.DirectoryServices;
using System.DirectoryServices.AccountManagement;
using System.Linq;
using System.Web;
using TheDomain.Common.Extensions;
namespace MobileApplications
{
public class Ldap35: IDisposable
{
private string _ldapserver;
private string _adminUser;
private string _adminPassword;
private PrincipalContext _connection;
private UserPrincipal _userData;
private IList<string> _groups;
public delegate void MessagingHandler(string message);
public event MessagingHandler Messaged;
public Ldap35(string server, string adminuser, string adminpassword)
{
_ldapserver = server;
_adminPassword = adminpassword;
_adminUser = adminuser;
}
/// <summary>
/// this will basically instantiate a UserPrincipal
/// </summary>
/// <param name="username">just the user</param>
/// <param name="pass">just the password</param>
/// <param name="domain">the correct domain, not sure if this is thedoamin.com or the_domain</param>
/// <returns></returns>
public bool Authenticate(string username, string pass, string domain)
{
if ( _connection == null)
EstablishDirectoryConnection();
ValidateConnection();
if (!domain.IsEmpty() && !username.Contains("\\") &