tags:

views:

212

answers:

2
+1  Q: 

File Path check

Hi

I wanted to chek file existance with UNC path.

But i thought UNC will slow for cheking of file.exist method.

so i want to map that UNC path and then check for the File Existance case..

how can i map drive using C# code..

and any one have exact idea about timing to check File Existance with UNC path & Map drive path..

as in my testing i found UNC is faster to check file existance compare to map drive..but wondering how it possible?

Thanks

A: 

Use the MapNetworkDrive method.

First add a reference to the "Windows Script Host Object Model" on the "Add reference" COM tab.

GvS
hi,Thanx for replay.When i am using that MapNetworlDrive code in C# it wan't allow me to use Wscript..?
+1  A: 

The speed deficiency really shouldn't have to do with using UNC paths over "regular" paths, but rather that you're accessing remote data. In other words, it's the network latency, session management and permissions checking that costs time, not string parsing.

Additionally, mapping (and unmapping) operations cost some time.

snemarch