'GetHostEntry' is not a member of 'System.Net.Dns'. qui peut m'aider svp ? HELP
Bonjour à tous,
voilà je réalise une petite application en VB.NET, le but est de récuppérer l'adresse ip des machines présentes dans l'AD ainsi que leur nom.
Pour les noms ça va je sais comment faire, mais pour récuppérer l'adresse ip des machines, le compilateur me retourne une erreur que je n'arrive pas à debuguer: 'GetHostEntry' is not a member of 'System.Net.Dns'.
quelqu'un pourrait-il m'aider à trouver une solution car là vraiment je suis bloqué ça fait des heures que je cherche et je n'avance pas.:cry:
Merci d'avance
Bien à vous.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
<%@ Page Language="VB" %>
<%@ Register TagPrefix="wmx" Namespace="Microsoft.Matrix.Framework.Web.UI" Assembly="Microsoft.Matrix.Framework, Version=0.6.0.0, Culture=neutral, PublicKeyToken=6f763c9966660626" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SqlClient" %>
<%@ import Namespace="System.Web.Mail" %>
<%@ import Namespace="System.IO" %>
<%@ import Namespace="System.DirectoryServices" %>
<%@ import Namespace="System.Configuration" %>
<%@ import Namespace="System.Net" %>
<%@ import Namespace="System.Net.GetHostEntry" %>
<script runat="server">
' Insert page code here
'
'Displays all computer names in an Active Directory
'Written 08/26/02 - John O'Donnell
Sub Button1_Click(sender As Object, e As EventArgs)
Try
'response.write("Button1_Click")
'lblError.Text = "abc" + 12
Dim Ldap As DirectoryEntry = new DirectoryEntry("LDAP://tamac.local", "faratbi", "faratbi")
Dim searcher As DirectorySearcher = New DirectorySearcher (Ldap)
searcher.Filter = "(objectClass=computer)"
Dim DirEntry As DirectoryEntry
Dim dns As Dns
' Nom de la machine
Dim NomMachine As String = Dns.GetHostName
' Récupération de la liste des IP de la machine
Dim InfoIps As IPHostEntry = Dns.GetHostEntry(NomMachine)
Dim MesIp As IPAddress() = InfoIps.AddressList
For Each result As SearchResult In searcher.FindAll
' On récupère l'entrée trouvée lors de la recherche
DirEntry = result.GetDirectoryEntry
'On peut maintenant afficher les informations désirées
'response.write("Login : " + DirEntry.Properties("SAMAccountName").Value)
response.write("Nom : " + DirEntry.Properties("Name").Value)
'response.write("IP : " + DirEntry.Properties("displayName").value)
'response.write("Email : " + DirEntry.Properties("mail").Value)
'response.write("Tél : " + DirEntry.Properties("TelephoneNumber").Value)
'response.write("Password : " + DirEntry.Properties("password").Value)
response.write("Ip : {0}", CurrentIp.ToString)
Next
Catch Ex As Exception
'lblError.Text =Ex.tostring
response.write(Ex.tostring)
End Try
'End Sub
End Sub
</script>
<html>
<head>
</head>
<body>
<form runat="server">
<asp:Button id="Button1" onclick="Button1_Click" runat="server" Text="Lister"></asp:Button>
<!-- Insert content here -->
</form>
</body>
</html> |