I am attempting to get the full UNC path for mapped drives using WNetGetConnection but am falling short in Production.
The routine works in development hosted by IIS on my local machine, but not in Production.
I am making sure to impersonate my own domain username to remove any permissions issues.
I have wrapped WNetGetConnection in a utility class as below.
<DllImport("mpr.dll", CharSet:=CharSet.Unicode, SetLastError:=True)> _
Public Shared Function WNetGetConnection( _
<MarshalAs(UnmanagedType.LPTStr)> ByVal localName As String, _
<MarshalAs(UnmanagedType.LPTStr)> ByVal remoteName As StringBuilder, _
ByRef length As Int64) As Integer
End Function
Public Shared Function GetUNCPath(ByVal originalPath As String) As String
Dim sb As New StringBuilder(512)
Dim size As Int64 = sb.Capacity
If (originalPath.Length ...
Go to the complete details ...