Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET
I want to use a folder in remote pc on my local network
i already ensure all the permission and remote pc share the folder also i add the code on web config
identity impersonate="true"
but whenever i want to access the the folder it gone to the C: path.
How can i access the folder
          
  path = "\\HP-PC\\GetFiles";
  String[] fileNamesWithoutExtention = Directory.GetFiles(@path,      "*.jpg").Select(fileName => Path.GetFileNameWithoutExtension(fileName)).ToArray();
Here the PC Name HP-PC
Folder Name GetFiles
Error:
Could not find a part of the path 'C:\HP-PC\GetFiles\'.
I will be thankful if anybody help Smile | :)
Posted 13-Dec-12 19:50pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

The problem is with the escape characters defined in path variable. Try this:
 
string path = @"\\HP-PC\GetFiles";
            String[] fileNamesWithoutExtention = Directory.GetFiles(@path, "*.avi").Select(fileName => Path.GetFileNameWithoutExtension(fileName)).ToArray();
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 231
1 CPallini 201
2 BillWoodruff 180
3 Maciej Los 165
4 Kornfeld Eliyahu Peter 160


Advertise | Privacy | Mobile
Web02 | 2.8.141015.1 | Last Updated 17 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100