Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File open dialog for non-mapped network paths 1

Status
Not open for further replies.

Nelviticus

Programmer
Sep 9, 2003
1,819
GB
I have built a small tool that requires users to open a file that can be stored on one of our many web servers. None of the drives are mapped but all are accessible via a UNC path such as \\<server name>\<drive letter>$\<path>.

I'm currently using OpenFileDialog. This gives you a standard Windows 'open file' dialog box with a 'look in' drop-down at the top and a 'my network places' link on the left. However, there is nowhere for you to manually type the file path.

The directories I need to reach do not appear in the 'look in' drop-down because they are not mapped and although you can navigate to the servers via 'my network places' you only see their shared web folders, not the servers' hard drives.

I happen to have a shortcut on my desktop to one of these drives and if I use the file dialog box to navigate to the shortcut and then double-click it, it takes me to the right place. However, if the user doesn't have a shortcut they can't use the file dialog to navigate there!

Does anyone have any ideas for getting around this? The open file dialog is capable of reading the server's drive but I can't see a way of pointing it there other than by a shortcut that has to be set up beforehand.

Regards

Nelviticus
 
I believe that you can manually type the file path in the filename textbox. For example, I can type the following:

\\server\d$

and then press enter in my open file dialogs. This will then open the UNC path and display the files there.

If I remember right, you do have to have access permissions established ahead of time though because it will not display the username password dialog if you don't have permissions, it will just fail.
 
Thanks dalchri, that will work. I had hoped that there was a different kind of OpenFileDialog that I could use, but having users type the path manually will at least get them there.

Access permissions are not an issue: if the user doesn't have permission to access the share normally then they shouldn't be able to access it with my app.

Nelviticus
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top