I have the following code on the code behind file for a .aspx page in a project:
Dim searcher As New ManagementObjectSearcher("SELECT RemoteName FROM win32_NetworkConnection WHERE LocalName = '" & sFilePath.Substring(0, 2) & "'")
For Each managementObject As ManagementObject In searcher.[Get]()
Dim sRemoteName As String = TryCast(managementObject("RemoteName"), String)
sRemoteName += sFilePath.Substring(2)
Return (New Uri(sRemoteName)).ToString()
Next
Return sFilePath
The ManagementObjectSearcher and the ManagementObject are both underlined and it is telling me that they are not defined.
I have added the System.Management reference, removed and readded, deleted my cache, rebuilt the whole .aspx page, removed the .dll and numerous other troubleshooting advise I have found on google but still cannot find the answer to this problem.
Please help!