Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using UNC path with credentials

I'm working on an app that uses an UNC path to access remote files in the same LAN. The problem is that when access is attempted it throws an exception related to Windows credentials.

Is there a way to add credentials to my UNC path?

Thank you

like image 965
avmauricio Avatar asked Apr 18 '12 17:04

avmauricio


People also ask

How do I give access to UNC path?

UNC path is just a special format for pointing to a folder on another computer. You first use two slashes “\\” and then the server name, \\testcomp and then another “\” followed by the shared folder path, \\testcomp\foldername. Make sure there is a tick next to “Reconnect at logon” to make the connection permanent.

What is the correct UNC path?

Answer: A UNC path, or Universal Naming Convention, is simply a shared folder on a computer. The purpose for this folder is so when you upgrade, the registers and back office computers know where the upgrade file is and can connect to it. An example of an UNC path is \\ComputerName\SharedFolder.

Can UNC path have IP address?

The host-name portion of a UNC name can consist of either a network name string set by an administrator and maintained by a network naming service like DNS or WINS, or by an IP address.

How do I assign a drive letter to UNC path?

In the windows that opens, select Computer > Map network drive. Select the drive letter for the network drive you would like to map, enter the UNC path in the Folder text field, then select Finish. The UNC path is the location of the shared folders you want to connect to.


2 Answers

It might be useful for you to use the NetUseAdd function from the windows api http://msdn.microsoft.com/en-us/library/windows/desktop/aa370645(v=vs.85).aspx. It allows you to access a directory through its UNC path.

like image 89
Fer Avatar answered Oct 01 '22 17:10

Fer


Looks like Win32 APIs are the most common way to handle this. Check out this SO post Accessing a Shared File (UNC) From a Remote, Non-Trusted Domain With Credentials

like image 40
Derek Risling Avatar answered Oct 02 '22 17:10

Derek Risling