<url:
http://www.devguru.com/Technologies/...shnetwork.html />
<url:
http://msdn.microsoft.com/library/en...wshnetwork.asp />
Instead of shelling out to run NET USE, why not use the methods built into the WshNetwork object?
var n = new ActiveXObject("WScript.Network"); // Server.CreateObject();
n.MapNetworkDrive("", "\\\\server\\path$", false, "user", "password");
I wrote and tested it in WSH, but it should work just as well in ASP, you just need to convert it to VBS (if desired) and change
"new ActiveXObject()" into "Server.CreateObject()".
Christopher Jedlicka wrote:
I have tried the "net use" command that you recommended and it seems
to work perfectly when I use the command directly. When I use the
command through script though, it correctly executes, but doesn't seem
to have any effect. It's running inside the same script just before I
use the file path and with the same security context with low
application protection in iis. Any reason this wouldn't apply through
script? Aside from the user/server information, I am using it exactly
as you had posted it.
-Chris
"Steve van Dongen [MSFT]" <st*****@online.microsoft.com> wrote in message news:<9i********************************@4ax.com>. .. On Sun, 3 Aug 2003 02:08:58 +0000 (UTC), "John Smith"
<jo**@nospam.spam> wrote:
Probably got the wrong end of the stick but can't this be done via XMLHTTP
or does the authentication issue get in the way ?
"Christopher Jedlicka" <ch******@jedlicka.net> wrote in message
news:ee************************@posting.google.co m...
> I am trying to write a script that will access files on another
> computer on the network but in a seperate domain. In order to access
> the files, I need to first authenticate to the other domain as a
> different user.
>
> When I access files on another domain via explorer, it prompts for a
> username/password. Is there some way I can pass this same information
> through scripting to access a computer in the other domain?
>
> I attempted to do this with impersonation, but if I understand
> correctly, in order to impersonate a user, the user must exist on the
> local computer running the script. The user that I would like to use
> exists only on the other domain.
>
> Does anyone know how this can be done?
If you're using anonymous authentication on this ASP page, you could
set the anonymous user to be the user which has permission to access
the share.
If you're looking for a code solution, before attempting to access the
share, try executing the command:
net use \\server\ipc$ /u:domain\user password
var sServer = "whatever";
var sDomain = "somedomain";
var sUser = "somebody";
var sPassword = "thisisnotsecure";
var oShell = Server.CreateObject("WScript.Shell");
oShell.Run("net use \\\\" + sServer + "\\ipc$ /u:" + sDomain + "\\" +
sUser + " " + sPassword, 0 , true);
Regards,
Steve
--
| Grant Wagner <gw*****@agricoreunited.com>
* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html
* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp
* Netscape 6/7 DOM Reference available at:
*
http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 6/7 and Mozilla
*
http://www.mozilla.org/docs/web-deve...upgrade_2.html