Click here to Skip to main content
15,843,145 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
If somebody can spot what is wrong here I will be eternally grateful !!!

Basically, a VB.net program that I run is playing up, it says that a file on my L: drive doesn't exist, when it clearly does !!! (If it helps, my L: drive is a Lima device)

The image I have linked to shows the error, the file in its Folder and the file actually being edited (this was opened after the error occurred).

This problem doesn't ALWAYS happen though ...

http://i63.tinypic.com/4i24ac.jpg

What I have tried:

Accessing the file when the PC says it doesn't exist !!!
Posted
Updated 8-Mar-16 3:44am
Comments
Maciej Los 7-Mar-16 6:56am    
Check full path to the file! Seems you've made some typo.
[no name] 7-Mar-16 7:10am    
What code you are using to access the file in L drive?
Philippe Mori 9-Mar-16 12:21pm    
Where is the code? Include relevant code in the question. This is what we expect here on Code Project.
Philippe Mori 9-Mar-16 12:23pm    
Check if you have access to the file with well known software like Notepad.
Gary Heath 10-Mar-16 9:24am    
Philippe, apart from the fact this problem is closed (although not resolved), if you had opened the link that is supplied, you would see not only the code, but also, as it says in the original post, the file being edited !!!

Mapped drives are user specific. Are you running the appdomain under a different user? IIS or Administrator?

If so, then you will either have to use the full //server/folder path or map the drives as runtime. That will guarantee that they are mapped for the correct user. I had a couple of .bat filed I would run on startup and shutdown of the app that mapped the drives for me.
 
Share this answer
 
Comments
Gary Heath 7-Mar-16 7:20am    
This is something I wrote to run on my Desktop, Andy, but have migrated it to the Lima so that I can run it from either my Desktop or my Laptop, so the user will change, depending on which machine I am using (My name is the same on both machines and I am an administrator on both, but I assume when you say "user specific", that takes the machine into consideration). I imagine I am going to run into a number of problems like this then :-(

Thanks, I will let you know if this resolves the problem ...
Andy Lanng 7-Mar-16 8:59am    
By "user specific" I mean that the person logged on (you) owns the mapped drives. The user the application runs under may not be you. If you "run as administrator" then it will use the administrator account, even if you have administrator rights. If it runs under IIS then the user is very unlikely to be you. These examples may not apply in your case, but there are more scenarios where this can happen.

Either way, never rely on mapped drives. It's always better to either map the drives at runtime, or use the full server path.
Andy Lanng 7-Mar-16 9:01am    
Also: You could run a test but outputting to the console or a log file (or the debug console) what drives appear mapped to the application. That may help with debugging
Gary Heath 7-Mar-16 10:04am    
I've just been looking into mapping the drive when something utterly bizarre hit me ... the actual program that I am running is on the L: Drive !! There are also a number of other files that are on the L: Drive that are all accessed perfectly OK until it gets to this file, where it crashes with the Not Found error !!!
Gary Heath 7-Mar-16 10:36am    
Andy (or anybody else who reads this, obviously !), I wondered if the problem may, for some reason, be caused by the accessing of the file being in a Function, so I have moved the code out of the Function and into the stream of the program. I am getting the same problem, but in the attached picture, you can clearly see that there are 2 files accessed here, they both exist in the same Folder on the L: Drive but it crashes when trying to find the second one !!!

http://i63.tinypic.com/e0o7ic.jpg
I have no idea why this will not work. Whilst I am quite sure that Andy Lanng's Network & Mapping advice is spot on, in this instance and under these circumstances (i.e. using a Lima device & their supplied software to access the external HD as a standard Hard Drive) it doesn't appear relevant.

Against all my experience and instincts & I have hard-coded the lines from the data file into a variable Array within the code and that way the program works, which right now is the most important thing !!!
 
Share this answer
 

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