473,385 Members | 2,044 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

File.OpenRead WinIOError with UNC Path when not connected to LAN

Hello Dear

As in the title above, im getting a WinIOError Exception (_COMPlusExceptionCode -532459699) if i would like to open a file for Read with "File.OpenRead(UNCPath)" and the network cable is not connected to the pc.

The UNC-Path is a legal path to the local harddisk ("\\\\DEV220\\D$\\Temp\\b.doc")
I do not get any error if i plugin the network cable.

Is there a way to open the file by another API call or is the only way to convert the path back to a Windows Path?

The errormessage is as following;
"The network location cannot be reached. For information about network troubleshooting, see Windows Help."

Seems to be a wrong internal handling?

Thanks for your help

Cis
Jun 4 '07 #1
7 2985
Plater
7,872 Expert 4TB
Are you on a domain? You might get something funky for that.
I just unplugged my cable and attempted to open (from the startmenu) \\mycomputer
And I was able to open that and see my shares, but when I tried to look into the shares directories I got a permission denied error.

I am fairly certain that unless you have some extra netbios protocols running, you shouldn't be able to use the UNC paths to your own computer without being connected to something that gives you an IP.

You could just trap that error and manipulate the UNC path to point to something different. Does the UNC path work if you replace your computer name with 127.0.0.1 ? Because that might work.
Jun 4 '07 #2
Hmm

I am connected to a domain, but i do not access shares in the network, i just want to access a file on my local disk via a UNC-Path. (D$ is a sharing from my local computer)

If i am not connected to the LAN, i get this Error (but i think it doesn't need network or something because all is completely local?)

I will try with 127.0.0.1 instead of my local host name and will post the result...
Jun 4 '07 #3
I tried with 127.0.0.1, no success

Strange thing is, if i put in the given path into the "run" box under "Start", the same error occurs.

I've tried with
\\D$\Temp\b.doc
and \\127.0.0.1\D$\Temp\b.doc"

I've really got no plan?

Thanks
Jun 4 '07 #4
Plater
7,872 Expert 4TB
If your computer is part of a domain, your security permisions and everything are obtained from the domain controller.
I've tried with
\\D$\Temp\b.doc
and \\127.0.0.1\D$\Temp\b.doc"
Both of those are accessing shares. Is there any way you can NOT use UNC paths for local actions? UNC is pretty much that standard format for using windows(samba) shares
Jun 4 '07 #5
I think if windows is generally not able to connect to a local Path via UNC if no Networkcable is connected, i have to reconvert the UNC Path to a Windows Path. Maybe there is some sourcecode on the www. Or another way?
Thanks again.
Jun 4 '07 #6
I think the only option is to reconvert the path, i do not have the path in this "normal windows path" form...

If your computer is part of a domain, your security permisions and everything are obtained from the domain controller.

Both of those are accessing shares. Is there any way you can NOT use UNC paths for local actions? UNC is pretty much that standard format for using windows(samba) shares
Jun 4 '07 #7
Plater
7,872 Expert 4TB
Well if you really wanted to get nasty with it, there is a way to find out all the shares on your system and where the physical location they point to is (You can see this by right-clicking my computer and choosing manage, then going to "Shared Folders" and then "Shares")
You can acces this information through code (WMI at the very least I would think) and then use this to determine how to convert the UNC path to a physical path.
Jun 4 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: moonriver | last post by:
I write a program accessing files in network drive o:. It is doable as a standalone application. However, if it is running under windows service, the following exception will appear: 13/07/2004...
0
by: Bill Burwell | last post by:
I am converting a VB6 WebClass application to VB.Net. Used the VB upgrade tool to do the conversion - and it left me a lot of little code things to do. Did those code things and got my app to...
4
by: R Reyes | last post by:
I am trying to code a file uploader (for forum/email attachments) from the client computer to a remote web server via the PUT method (since POST is not allowed ). However, the upload works ONLY...
4
by: Michael | last post by:
I am trying to open a file on the client machine from an aspx page running server side. The design requirements of the page specify that the HtmlInputFile control is not to be used. Since the...
0
by: Shane | last post by:
I got a problem when users use Netscape to upload document to webserver. All things are working fine with IE users. The warning message I got is something like Diagnostic Data Could not find a...
3
by: Don | last post by:
I have a strange bug popping up every once in a while. I've got a section of code that executes these statements when working with a streamwriter: --- Start --- .... ' Close the...
1
by: kkizer | last post by:
I have a problem with this simple code below. Moving the files works perfectly, but once in a blue moon the file that it is trying to move dissapears before it can move it. and when this happens...
2
by: jlacefie | last post by:
Hello, I am having trouble with the following code using ASP.Net 2.0. I recieve an error on the line File.OpenRead(fPath) stating could not find file . The fPath comes from a textbox control...
3
by: JDeats | last post by:
I have some .NET 1.1 code that utilizes this technique for encrypting and decrypting a file. http://support.microsoft.com/kb/307010 In .NET 2.0 this approach is not fully supported (a .NET 2.0...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.