Bonjour à tous,
mon compilateur n'arrête pas de me renvoyer ce message d'erreur : End of statement expected à la ligne 32 .
Quelqu'un pourrait me dire où ce trouve l'erreur svp ?
Bien à vous.
Source Error:
Line 30: Dim IPHost As IPHostEntry = Dns.Resolve(Dns.GetHostName())
Line 31: Dim addressList As IPAddress() = IPHost.AddressList
--> Line 32: Dim a As IPAddress In addressList
Line 33: 'Dim dns As Dns
Line 34: ' Nom de la machine
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
83 <%@ 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" %> <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 ' Définition des objets 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 IPHost As IPHostEntry = Dns.Resolve(Dns.GetHostName()) Dim addressList As IPAddress() = IPHost.AddressList Dim a As IPAddress In addressList '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 'Response.Write(DirEntry.) '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("address.Append").a.ToString()) '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>
Partager