Hi all
I am using C#/.Net2.0
I am connecting to a remote shared folder from my C# code using WNetAddConnecti on2A without mapping to the local drive.
A code snippet is:
The Exception is:
The above block of code is in base class, and its been used by two different childs which are called from two different threads. A pseudo class is given below.
One of childs is throwing this exception. Any guesses on this error is really appreciated.
Thanks
Ram
I am using C#/.Net2.0
I am connecting to a remote shared folder from my C# code using WNetAddConnecti on2A without mapping to the local drive.
A code snippet is:
Code:
NetResource netRes = new NetResource(); netRes.scope = RESOURCE_GLOBALNET; netRes.type = RESOURCETYPE_DISK; netRes.displayType = RESOURCEDISPLAYTYPE_SHARE; netRes.usage = RESOURCEUSAGE_CONNECTABLE; netRes.remoteSharedName = shareName; netRes.localMappedDriveName = localMappedDrive; int retcode = WNetAddConnection2A(ref netRes, pwd, usr, 0); String[] fileColl = Directory.GetFiles(shareName); // foreach file in fileColl DateTime dt = File.GetLastWriteTime(absFileName);//Here the exception is thrown.
Type : System.IO.IOExc eption, mscorlib, Version=2.0.0.0 , Culture=neutral , PublicKeyToken= b77a5c561934e08 9
Message : An unexpected network error occurred.
Source : mscorlib
Help link :
Data : System.Collecti ons.ListDiction aryInternal
TargetSite : Void WinIOError(Int3 2, System.String)
Stack Trace : at System.IO.__Err or.WinIOError(I nt32 errorCode, String maybeFullPath)
at System.IO.File. GetLastWriteTim eUtc(String path)
at System.IO.File. GetLastWriteTim e(String path)
Message : An unexpected network error occurred.
Source : mscorlib
Help link :
Data : System.Collecti ons.ListDiction aryInternal
TargetSite : Void WinIOError(Int3 2, System.String)
Stack Trace : at System.IO.__Err or.WinIOError(I nt32 errorCode, String maybeFullPath)
at System.IO.File. GetLastWriteTim eUtc(String path)
at System.IO.File. GetLastWriteTim e(String path)
Code:
class base
{
// above code snippet
}
class d1: base
{
}
class d2: base
{
}
Thanks
Ram
Comment