tags:

views:

26

answers:

1

Hello,

I am using netfileenum in vb.net to see open files. When I am passing null as the servername,basepath,user as a parameter in netfileenum function, it is working fine and showing the opened files of local system but if I pass servername as "servername" for remote machine, I am getting error as 123. How to pass the servername in netfileenum function? Please suggest.

A: 

I don't know if it will help, but I've read that servername must be unicode, so try following:

Dim srvName As String = " MyServerName "
Dim srvUnicode As String = System.Text.Encoding.ASCII.GetString(System.Text.Encoding.Unicode.GetBytes(srvName.Trim))
Tim Schmelter
Strings in .NET are already Unicode. Your code does nothing but create problem for non-ASCII characters. If user359562's problem really is with the string encoding, he or she should look at the Declare statement (or DllImport attribute) instead.
Mattias S
@Mattias: Thanks for clarifying that, i couldnt test it. It was a shot in the dark.
Tim Schmelter