Forum

ISS 7.5 LDAP Sorunu
 
Bildirimler
Hepsini Temizle

ISS 7.5 LDAP Sorunu

4 Yazılar
3 Üyeler
0 Likes
542 Görüntüleme
(@erolergul)
Gönderiler: 22
Eminent Member
Konu başlatıcı
 

Merhaba asp.net 4.0 ile LDAP entegre firma içinde kullanılmak üzere bir web uygulaması yaptım . Localimde çok güzel çalısıyor fakat servere attığımda Error obtaining group names. An operations error occurred.  şeklinde bir hata alıyorum sıkıntı nedir acaba? ISS Tarafında mı diye düşündüm ama bir türlü bulamadım

 

Teşekkürler

kodlarım bu şekilde

string adPath = "LDAP://10.1.1.237/DC=groupname,DC=local";
LdapAuthentication adAuth = new LdapAuthentication(adPath);

try
{
if (true == adAuth.IsAuthenticated(txtDomain.Text,
txtUsername.Text,
txtPassword.Text))
{
string groups = adAuth.GetGroups();
FormsAuthenticationTicket authTicket =
new FormsAuthenticationTicket(1, // version
txtUsername.Text,
DateTime.Now,
DateTime.Now.AddMinutes(60),
false, groups);
string encryptedTicket =
FormsAuthentication.Encrypt(authTicket);
HttpCookie authCookie =
new HttpCookie(FormsAuthentication.FormsCookieName,
encryptedTicket);
Response.Cookies.Add(authCookie);

Response.Redirect("/xxx/");
}
else
{
errorLabel.Text =
"Authentication failed, check username and password.";
}
}
catch (Exception ex)
{
errorLabel.Text = "Error authenticating. " + ex.Message;
}

 

//Makinaların tamamı aynı domain içinde

//Server 2008 r2 kurulu

 
Gönderildi : 19/01/2016 13:11

(@kenanilgun)
Gönderiler: 544
Üye
 

Merhaba,

Oturum açtığınız kullanıcı bir gruba dahil mi? Kontrol ettiniz mi?

İyi çalışmalar.

 
Gönderildi : 19/01/2016 14:25

(@erolergul)
Gönderiler: 22
Eminent Member
Konu başlatıcı
 

Evet kullanıcım domainde grup derken herhangi bir grup seçimi yok domainde olan tüm kullanılıcal giriş yapabiliyor İşin garibi kendi makinamdan giriş yapıyorum fakat kodları derleyip servere attığımda hatayı alıyorum

 
Gönderildi : 19/01/2016 14:44

(@eravse)
Gönderiler: 1753
Üye
 

Erol selam bu şekilde bir arama yapamazsınız bu kod hata dönecektir zaten, aşağıdaki şekilde denermisiniz

 

// create your domain context
PrincipalContext ctx = new PrincipalContext(ContextType.Domain);

// define a "query-by-example" principal - here, we search for a GroupPrincipal 
GroupPrincipal qbeGroup = new GroupPrincipal(ctx);

// create your principal searcher passing in the QBE principal    
PrincipalSearcher srch = new PrincipalSearcher(qbeGroup);

// find all matches
foreach(var found in srch.FindAll())
{
    // do whatever here - "found" is of type "Principal" - it could be user, group, computer.....          
}


yada diğer bir çözüm

 public ArrayList GetAllGroupNames(string ipAddress, string ouPath)
    {
        DirectorySearcher deSearch = new DirectorySearcher();
        deSearch.SearchRoot = GetRootDirectoryEntry(ipAddress, ouPath);
        deSearch.Filter = "(&(objectClass=group))";
        SearchResultCollection results = deSearch.FindAll();
        if (results.Count > 0)
        {
            ArrayList groupNames = new ArrayList();

            foreach (SearchResult group in results)
            {
                var entry = new DirectoryEntry(group.Path, UserName, Password);
                string shortName = entry.Name.Substring(3, entry.Name.Length - 3);
                groupNames.Add(shortName);
            }

            return groupNames;
        }
        else
        {
            return new ArrayList();
        }
    }

saygılar
 

ProfectSoft Yazılım ve Danışmanlık Hizmetleri
LogPusher & Bifyou E-Commerce System
www.profectsoft.com

 
Gönderildi : 21/01/2016 02:48

Paylaş: