Click here to Skip to main content
13,198,322 members (65,136 online)
Rate this:
Please Sign up or sign in to vote.
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.

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 0:12am
Updated 26-Feb-13 3:00am
CHill60 22-Feb-13 6:24am
Do you have a share set up on that server e.g. "C_Drive on bemech002m"?
Darthillian 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
Darthillian 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!!
Darthillian 22-Feb-13 6:43am
You made me see which mistake I made, so many thanks :D
aspnet_regiis -i 22-Feb-13 6:28am
You need to share that folder...
Darthillian 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
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 ;)

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.171020.1 | Last Updated 26 Feb 2013
Copyright © CodeProject, 1999-2017
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