Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.

C#
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
Updated 26-Feb-13 3:00am
v2
Comments
CHill60 22-Feb-13 6:24am    
Do you have a share set up on that server e.g. "C_Drive on bemech002m"?
Nomardus 22-Feb-13 6:27am    
Not that I am aware of.
CHill60 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
Nomardus 22-Feb-13 6:36am    
As I see it, it states "(S:) Service_Desk (\\bemech002m\BemechData2\ITSB)
CHill60 22-Feb-13 6:41am    
Ah - and you already have that in your path so that blows my theory out of the water!!

1 solution

Ok, thanks for all the advise, I found my stupid mistake.
And thanks Chill60 to point it out ;)

The path should be "\\bemech002m\BemechData2\ITSB\Service_Desk\_Remedy Email Reply Scripts\Remedy Scripts Central\Dutch"
 
Share this answer
 
v2
Comments
CHill60 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900