Click here to Skip to main content
15,881,742 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have Explorer.exe started using process.Start() to try to read a network location and, if ok, it just shuts down explorer.exe and program continues. If the NW location is unable to be opened by explorer.exe I wish to read the error message. I am an elderly complete amateur and any help would be much appreciated in reading the explorer.exe message.

EDIT: (Additional information after Solution 1 and comments copied from non solution below)
Sorry about the unclear bit - the 'network location' is a drive on my home network. The drive is used to store files so that my wife and I can both use them. I have a prog that checks the drive and then copies whatever program is to run to the appropriate PC and then runs that prog locally - eg we both use the same password manager.
I guess the answer for HTTPWebRequest is not appropriate (or is it?).

What I have tried:

Tried lots of examples and suggestion from various websites, but nothing seems to do what I want.
Posted
Updated 4-Apr-19 11:05am
v3
Comments
Dave Kreskowiak 4-Apr-19 15:25pm    
You should edit your question and be a bit more specific about what you mean by "network location". Are you talking about a website address, starting with "http" or are you talking about shared network drives and UNC paths?

Explorer.exe is for shared network drives, not web sites.

Also, you cannot get anything back from the launch of Explorer.exe. There's no way to read the error message from your code.

You can use HTTPWebRequest and HTTPWebResponse to do this without running IE. The web response will contain the error.

How to: Request data by using the WebRequest class | Microsoft Docs[^]
 
Share this answer
 
v2
Comments
Richard Deeming 4-Apr-19 15:03pm    
I suspect "network location" means a UNC path, rather than a website. :)
#realJSOP 4-Apr-19 15:04pm    
That shouldn't matter.
Nelek 4-Apr-19 17:03pm    
question updated
Sorry about the unclear bit - the 'network location' is a drive on my home network. The drive is used to store files so that my wife and I can both use them. I have a prog that checks the drive and then copies whatever program is to run to the appropriate PC and then runs that prog locally - eg we both use the same password manager.
I guess the answer for HTTPWebRequest is not appropriate (or is it?).
 
Share this answer
 
Comments
Nelek 4-Apr-19 17:02pm    
don't use solutions to chat with people. In this case you should have used the "improve question" to add the relevant information to your original message, then a "comment" (question updated) to the other guys, would do the job.

I am doing it for you this time

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