473,569 Members | 2,590 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 22357
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 ?
"Christophe r Jedlicka" <ch******@jedli cka.net> wrote in message
news:ee******** *************** *@posting.googl e.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.CreateOb ject();
n.MapNetworkDri ve("", "\\\\server\\pa th$", 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.CreateO bject()".

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.sp am> 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 ?
"Christophe r Jedlicka" <ch******@jedli cka.net> wrote in message
news:ee******* *************** **@posting.goog le.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?

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 = "thisisnotsecur e";
var oShell = Server.CreateOb ject("WScript.S hell");
oShell.Run("net use \\\\" + sServer + "\\ipc$ /u:" + sDomain + "\\" +
sUser + " " + sPassword, 0 , true);

Regards,
Steve


--
| Grant Wagner <gw*****@agrico reunited.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
2684
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 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...
1
2529
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 When the user login the username and password in http://server1/login.asp, and clic submit button, it will go to http://server1/page1.asp if the...
9
1958
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 page. Once the user logs in then they are directed to the appropriate link. So for all 3 links they all go to a login page, but each link must pass...
7
3182
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 -- UC/ ----- Classic/
1
2112
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 (app2.myapp.com) and I want to pass the authentication of application 2 with backend process. Also, security issue is first priority. Thanks in...
1
3322
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 what is wrong? public void Login(string user, string pwd, string domain) { string path = "<<my ldap path>>"; DirectoryEntry domainEntry = new...
2
2076
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 Premium.aspx - which explains the advantages of being a Premium member and provides examples of content. The default page for site visitors is...
0
1461
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 know how i can do when the user login it take you the next page i want to display user first anem in the txtbox and last name in the other text box so...
2
2383
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 accessing this application from off campus, they routinely get this login window confused with the one they login to Exchange Sever with for their...
0
7701
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7615
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7924
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8130
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7677
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7979
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5514
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3643
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2115
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.