Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#3.0 C# C#4.0
I need to read some text files from a server.
It works when I use the drive letter on my personal computer, but since not every uses the same drive letter I need to make it work using the server name \\bemech002m
But the problem is that I get an error back when I try this.
 
private void Dutch_Click(object sender, EventArgs e)
        {
            string s = File.ReadAllText(@"C:\Users\a961835\Programming");
            textBox1.Text = s;
        }
 
A first chance exception of type 'System.IO.DirectoryNotFoundException' occurred in mscorlib.dll
 
Additional information: Could not find a part of the path 'C:\Users\a961835\Programming'.
 
If there is a handler for this exception, the program may be safely continued.
 
Any suggestions?
Posted 22-Feb-13 1:12am
Edited 26-Feb-13 4:00am
v2
Comments
CHill60 at 22-Feb-13 6:24am
   
Do you have a share set up on that server e.g. "C_Drive on bemech002m"?
Darthillian at 22-Feb-13 6:27am
   
Not that I am aware of.
CHill60 at 22-Feb-13 6:34am
   
If you open Windows Explorer (sorry I'm making an assumption that it's Windows) and look at your own drive mapping in the left hand pane does it say something like "xxxxxx on 'bemech002m' (X:)" - if so then you'll need to insert the xxxxx bit into your path
Darthillian at 22-Feb-13 6:36am
   
As I see it, it states "(S:) Service_Desk (\\bemech002m\BemechData2\ITSB)
CHill60 at 22-Feb-13 6:41am
   
Ah - and you already have that in your path so that blows my theory out of the water!!
Darthillian at 22-Feb-13 6:43am
   
You made me see which mistake I made, so many thanks :D
aspnet_regiis -i at 22-Feb-13 6:28am
   
You need to share that folder...
Darthillian at 22-Feb-13 6:35am
   
The thing is that I can perfectly access it with the drive letter but not when I try to bypass the drive letter by filling in the servername like in the example

1 solution

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

Solution 1

Ok, thanks for all the advise, I found my stupid mistake.
And thanks Chill60 to point it out Wink | ;)
 
The path should be "\\bemech002m\BemechData2\ITSB\Service_Desk\_Remedy Email Reply Scripts\Remedy Scripts Central\Dutch"
  Permalink  
v2
Comments
CHill60 at 22-Feb-13 7:09am
   
It's always the "obvious" things that catch us out !! :-)

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



Advertise | Privacy | Mobile
Web01 | 2.8.1411022.1 | Last Updated 26 Feb 2013
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