Access UNC path programmatically

I have an application running on local area network. It will usually update itself by checking the most up-to-date files from network folder shared from a server. My problem is that the shared folder are restricted access right by user and password. That means I have to connect to that shared folder prior to running the application. It is unaccepted by someone who can force me to find better solution. And now I found below code.

var n = new ActiveXObject("WScript.Network"); // Server.CreateObject();
n.MapNetworkDrive("", "\\\\server\\path$", false, "user", "password");

I taken above code from a thread. Hopefully it works. I have not tried it yet.

Tags: , , ,

Post new comment