473,406 Members | 2,371 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,406 software developers and data experts.

Connecting to a network share

Hi,

I'm trying to connect to a network share using a username / password /
domain of my choosing.

I've tried the WindowsIdentity.Impersonate route but can only impersonate
the users on the local machine / domain using this method.

I could go about creating actual mapped drives but I'd much rather connect
temporarily to a UNC share without affecting the system configuration.

I've Googled this one to death. Does anybody have any ideas?

Thanks,
Matt
Nov 19 '05 #1
4 2681
Hi Matt:

I take it the second machine is not in the same domain?

One approach would be to create a local user account on the remote
machine with the same username and password as a user on the web
server.

Mapped drives are a no-no in ASP.NET because they only load for an
interactive user, i.e. a user logged into a visible desktop, which the
asp.net worker process does not.

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Wed, 18 May 2005 14:00:30 +0100, "Matt Dockerty" <Ps reply to
group> wrote:
Hi,

I'm trying to connect to a network share using a username / password /
domain of my choosing.

I've tried the WindowsIdentity.Impersonate route but can only impersonate
the users on the local machine / domain using this method.

I could go about creating actual mapped drives but I'd much rather connect
temporarily to a UNC share without affecting the system configuration.

I've Googled this one to death. Does anybody have any ideas?

Thanks,
Matt


Nov 19 '05 #2
Hi Scott,

Thanks for answering. Yes they are completely separate machines. I can
impersonate an interactive user if needs be, the application is secured and
I have free reign over the server it will run on if I need to do anything
hacky, but I was kinda hoping I wouldn't have to.

Beats me why I need to physically impersonate a user, I imagine explorer
doesn't change the account it's running under to view a network share.

The application I'm writing makes files, then using the username, password,
domain in it's database connects out to machines on their admin share and
deploys them (lots of security to think about I know). I'm considering
writing some client software now for the machines it deploys to - C# just
doesn't seem to be up to the task.

Cheers,
Matt

"Scott Allen" <sc***@nospam.odetocode.com> wrote in message
news:hd********************************@4ax.com...
Hi Matt:

I take it the second machine is not in the same domain?

One approach would be to create a local user account on the remote
machine with the same username and password as a user on the web
server.

Mapped drives are a no-no in ASP.NET because they only load for an
interactive user, i.e. a user logged into a visible desktop, which the
asp.net worker process does not.

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Wed, 18 May 2005 14:00:30 +0100, "Matt Dockerty" <Ps reply to
group> wrote:
Hi,

I'm trying to connect to a network share using a username / password /
domain of my choosing.

I've tried the WindowsIdentity.Impersonate route but can only impersonate
the users on the local machine / domain using this method.

I could go about creating actual mapped drives but I'd much rather connecttemporarily to a UNC share without affecting the system configuration.

I've Googled this one to death. Does anybody have any ideas?

Thanks,
Matt

Nov 19 '05 #3
Hi Matt:

See inline...

On Wed, 18 May 2005 16:53:31 +0100, "Matt Dockerty" <Ps reply to
group> wrote:
Hi Scott,

Thanks for answering. Yes they are completely separate machines. I can
impersonate an interactive user if needs be, the application is secured and
I have free reign over the server it will run on if I need to do anything
hacky, but I was kinda hoping I wouldn't have to.

There are many options, and most of them are not hacky (mapped drives
are hacky). Impersonation is one option, delegation is another option
- but only if both machines are in a domain. Using mirrored accounts
will certainly work in your environment - did you try that? Do you
need to access the UNC with the client's credentials? Or can you
access the UNC for all incoming web clients with the same credentials?

Beats me why I need to physically impersonate a user, I imagine explorer
doesn't change the account it's running under to view a network share.

It depends on so many factors, for instance, are you running under
IIS5 or IIS6? On IIS5 the default ASPNET account used to execute code
doesn't have network access.
The application I'm writing makes files, then using the username, password,
domain in it's database connects out to machines on their admin share and
deploys them (lots of security to think about I know). I'm considering
writing some client software now for the machines it deploys to - C# just
doesn't seem to be up to the task.


This isn't a problem with C# in particular, you'll find the same
problem in any language or runtime. It works this way because of
Windows security features.

--
Scott
http://www.OdeToCode.com/blogs/scott/
Nov 19 '05 #4
Hi Scott,

I'll be using the logon details stored in the apps database. Having local
accounts with the same username and password might be the way to do it but
doesn't give the admins much flexibility in keeping their network secure.
Maybe I could temporarily create a local account with no permissions - mmm,
hacky :)

That's a bit clearer to me now. Thanks for all your help.

Cheers,
Matt

"Scott Allen" <sc***@nospam.odetocode.com> wrote in message
news:nt********************************@4ax.com...
Hi Matt:

See inline...

On Wed, 18 May 2005 16:53:31 +0100, "Matt Dockerty" <Ps reply to
group> wrote:
Hi Scott,

Thanks for answering. Yes they are completely separate machines. I can
impersonate an interactive user if needs be, the application is secured

and
<snip>
Nov 19 '05 #5

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

Similar topics

5
by: ysrana2001 | last post by:
In my office we have two SCO OpenServer (TM) Release 5 servers with two different terminals network. Now we have to join both server and windows server to share some file. Before we use generally...
5
by: JohnFol | last post by:
I am using the Win23 API WNetCancelConnection2 and can sucessfully make a connection to a share within my class. The class is called from a Windows Form based test harness. When I instantiate...
3
by: N.K. | last post by:
Hi, I've just installed postgres on the Linux server. It is supposed to start automatically which I think it does since I can run an sql stmt right away. When I'm trying to connect from a remote...
1
by: Dishaa V | last post by:
Hello I need to connect to an access db which is on the internet. I do know that URL of the same. its http://www.vallury.com/balance/bank.mdb. Its just a test db. How can I connect to that db...
1
by: brian.oneil2 | last post by:
Is there a way to install this onto a network file share and allow a team to access it? I would say share a CD from a networked CD drive, but there are multiple CD's that would have to be inserted....
3
by: musosdev | last post by:
Hi guys Okay, I've setup my projects to open and compile fine in VS2005 using FPSE and remote web, but it's *really* slow. So I thought I'd have a go at doing it the normal way, by loading from...
4
by: Jeremy S. | last post by:
We're in the process of writing a new Windows Forms app and the desktop support folks want for it to be run from a network share. I know it's possible (i.e., just have the framework on the clients...
6
by: tendim | last post by:
G'day group. Currently our organization us using VB6 based applications, and I am trying to push forward and migrate some of the smaller things to VB.NET, eventually migrating all applications...
4
by: duffaz | last post by:
I am trying to I am trying to connect to an SQL Server using a vb.net program. It works if I put it on the SQL Server computer, but will not connect over my local network that is set up as a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
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,...

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.