Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / July 2006

Tip: Looking for answers? Try searching our database.

Accessing fileshare using system.IO

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Michel Smit - 25 Jul 2006 06:19 GMT
I have a machine in a domain 'HOME' and a machine in a DMZ which is not able
to communicate with the 'HOME' domain, and thus has it's own local users and
groups.

I'm writing a .NET assembly which will copy files from the machine in the
domain to the machine in the DMZ. When mapping a drive in Explorer I use the
credentials of the DMZ machine: NLIIS405\copyuser, password: copyuser. This
proves that the connection is available.

The problem is the file.copy in the assembly. I always get an access denied
because I should copy the file using the DMZ machine credentials.

Is there a way to copy files from the domain machine to the DMZ machine
using a DMZ machine login? I suspect it has to do with impersonation, but
don't know if the above is possible.

Does someone has experience with connecting to a network share from a server
which is not connected to a domain?
Signature

Michel Smit
Atos Origin Nederland BV

Laura T - 25 Jul 2006 09:40 GMT
It is possible. You could also grant permissions for an user of your domain.
Otherwise you could do a WNetAddConnection2/3 to "logon" on the DMZ machine
(in effect you simulate a net use), copy the file and then delete the
connection.

WNetAddConnection3(Form1.Handle,MapDriveStruct,"copyuser","NLIIS405\copyuser",CONNECT_INTERACTIVE);
File.Copy(...)
WNetCancelConnection2(...)

Docs for WNetXXX APIs are here:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wnet/wnet/windo
ws_networking_functions.asp


>I have a machine in a domain 'HOME' and a machine in a DMZ which is not
>able
[quoted text clipped - 20 lines]
> server
> which is not connected to a domain?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.