Preciso Autenticar no Active Diretory com Delphi Prism
12/11/2009
0
Olá a todos, preciso fazer autenticação em um Dominio com Active Directory usando Delphi Prism, tentei adaptar esse código que está em CSharp, porem não consegui, se alguem tiver uma lUz eu agradeço.
https://www.devmedia.com.br/articles/viewcomp.asp?comp=6990&hl=*Active*%20and%20*Directory*
using system; using system.collections.generic; using system.text; using system.data.sqlclient; using system.data; using system.directoryservices; namespace activedirectory { public class authoad { public string autentica(string ipserver, string user, string senha) { string retorno = string.empty; try { directoryentry objad = new directoryentry("ldap://" + ipserver, user, senha); retorno = objad.name; } catch (exception ex) { throw new exception(ex.message); } return retorno; } } }
//****
codebehind da página default using system.data; using system.configuration; using system.web; using system.web.security; using system.web.ui; using system.web.ui.webcontrols; using system.web.ui.webcontrols.webparts; using system.web.ui.htmlcontrols; using activedirectory; public partial class _default : system.web.ui.page { protected void page_load(object sender, eventargs e) { } protected void btlogar_click(object sender, eventargs e) { authoad objad = new authoad(); try { response.write(objad.autentica("192.168.0.2", txtuser.text, txtsenha.text) + "<br>"); } catch (exception ex) { response.write(ex.message); } } }
Grato por qualquer ajuda
Paulo R. Freire
https://www.devmedia.com.br/articles/viewcomp.asp?comp=6990&hl=*Active*%20and%20*Directory*
using system; using system.collections.generic; using system.text; using system.data.sqlclient; using system.data; using system.directoryservices; namespace activedirectory { public class authoad { public string autentica(string ipserver, string user, string senha) { string retorno = string.empty; try { directoryentry objad = new directoryentry("ldap://" + ipserver, user, senha); retorno = objad.name; } catch (exception ex) { throw new exception(ex.message); } return retorno; } } }
//****
codebehind da página default using system.data; using system.configuration; using system.web; using system.web.security; using system.web.ui; using system.web.ui.webcontrols; using system.web.ui.webcontrols.webparts; using system.web.ui.htmlcontrols; using activedirectory; public partial class _default : system.web.ui.page { protected void page_load(object sender, eventargs e) { } protected void btlogar_click(object sender, eventargs e) { authoad objad = new authoad(); try { response.write(objad.autentica("192.168.0.2", txtuser.text, txtsenha.text) + "<br>"); } catch (exception ex) { response.write(ex.message); } } }
Grato por qualquer ajuda
Paulo R. Freire
Paulo Freire
Curtir tópico
+ 0
Responder
Clique aqui para fazer login e interagir na Comunidade :)