473,398 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

How can I pass user login for UNC path?

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?

-Chris
Jul 20 '05 #1
2 22349
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.com ...
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?

-Chris

Jul 20 '05 #2
<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
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Christopher Jedlicka | last post by:
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...
1
by: Joe | last post by:
I have 3 servers server1: http://server1/login.asp, http://server1/page1.as server2: http://server2/login.asp, http://server2/page1.as server3: http://server3/login.asp, http://server3/page1.as ...
9
by: Paul | last post by:
What I am trying to do is as follows. I have a page with 3 links,that direct the user to 3 different pages when selected after login. So all link selections will first direct the user to a login...
7
by: Samuel | last post by:
Hi, I am building a page that makes use of user control as a templating technique. The following is that I have in mind and it is actually working: Root/ -- login.aspx -- login.aspx.vb --...
1
by: beachboy | last post by:
how can pass the login (security info) to secondary application? ASP.NET 1.1 user login to application 1(app1.myapp.com) with their username and password, then they have a link to application 2...
1
by: Raghu | last post by:
I have following code that validates a given user credentails against a active directory. The login part works but I can not search as it fails to return the record. Does any one have any idea...
2
by: mark4asp | last post by:
This is a simplified version of my site. There are Premium users who have access to the Premium directory. Anyone else attempting to access it should be logged and then redirected to the...
0
by: preeti13 | last post by:
Hi friends i am here again with my probelm. i have one login page when first login on the page it is checking the active directory user exist or not if user exist then go the next page all i nee to...
2
by: adam.waterfield | last post by:
Maybe someone could help me a little here. On a project I am working on, we have some LDAP authentication to Active Directory which allows users to login to our application - this is fine. When...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.