Visual Basic.NET - Cambiar Codigo a .NET

 
Vista:

Cambiar Codigo a .NET

Publicado por YACS (2 intervenciones) el 21/07/2010 16:30:06
Hola
Alguien a trannsformado este codigo a .NET

Dim oRootDSE, oCon, oCmd, oRecordSet
Dim sDomainADsPath, sUser, sPassword, sGroup, sProperties, nombreusuario
Dim aDescription, aMember, iCount
Set oRootDSE = GetObject("LDAP://RootDSE")
sDomainADsPath = "LDAP://" & oRootDSE.Get("defaultNamingContext")
Set oRootDSE = Nothing
Set oCon = Server.CreateObject("ADODB.Connection")

nombreusuario = mid(Request.ServerVariables("LOGON_USER"),11)

sUser = "user"
sPassword = "clave"
oCon.Provider = "ADsDSOObject"
oCon.Open "ADProvider", sUser, sPassword
Set oCmd = Server.CreateObject("ADODB.Command")
Set oCmd.ActiveConnection = oCon
sProperties = "name,samaccountname,ADsPath"
sGroup = nombreusuario
oCmd.CommandText = "<" & sDomainADsPath & ">;(&(objectCategory=user)(samaccountname=" & sGroup & "));" & sProperties & ";subtree"
oCmd.Properties("Page Size") = 100
Set oRecordSet = oCmd.Execute
'response.write sDomainADsPath
'Response.Write("Dominio: " & Replace(Mid(sDomainADsPath,11), ",DC=", ".") & "<br>")
While Not oRecordSet.EOF
Response.Write(oRecordSet.Fields("name") & "<br>")
Response.Write(oRecordSet.Fields("ADsPath")& "<br>")
Response.Write(oRecordSet.Fields("SAMAccountName")& "<br>")
ruta=oRecordSet.Fields("ADsPath")
response.Write(ruta)
oRecordSet.MoveNext
Wend
oRecordSet.Close
oCon.Close
Set oRecordSet = Nothing
Set oCon = Nothing
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Cambiar Codigo a .NET

Publicado por Damian (824 intervenciones) el 23/07/2010 14:45:32
Si, lo he hecho y que necesitas saber?. Debes sacar todos los Set y a algunas declaraciones les debes anteponer el operador New.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Cambiar Codigo a .NET

Publicado por YACS (2 intervenciones) el 23/07/2010 15:09:54
Hola, gracias por contestar

he usado una sentencia pero no me devuelve el ADsPath, necesito que me devuelva la OU del usuario

Sabes de otra forma obtener este daotr

Atte.,

YACS
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar