How can I check if filepath is is UNC format...

How can I check if filepath is is UNC format…? and is there any method that I can convert the mapped path to UNC format?

It depends what exactly you want to achieve. For example, you can simply check whether the path starts with ‘\’. Or you can use the following:

System.Uri uri = new System.Uri(@"\\mymachine\c$\xyz");
boolean isUnc = uri.get_IsUnc();

About converting… it surely is possible but it depends on the input you expect.

Thank you so much martin… :slight_smile: [:D]

I have a question martin… when i give System.Uri uri = new System.Uri(@"\mymachine\c$\xyz");

or anything after \---- it considers as my local system c drive.

eg :System.Uri uri = new System.Uri(@"\emma\c$\xyz"); [note : emma is not existing anywhere].

it still looks for c$ folder in c drive…

I have a requirement to print a file in network shared folder… can you help me out …

The code I gave you doesn’t look anywhere; it merely checks whether the path is in UNC format- exactly what you have asked for.

You have a problem in some code of yours that actually looks for the file. If you fail to fix it and need advice, you’ll have to show your code.