Solved

How to copy files to a password protected shared folder on another server

Posted on 2012-03-22
4
1,671 Views
Last Modified: 2012-03-27
Hi,

I can manually in Windows 7: Type in Run: \\<ip address>\sharedFolder, type in my username and password, a folder opens in Windows Explorer, I can then copy a file to the shared folder.

How can I do this in C#? I can do a File.Copy() but I can't get around the part about specifying the username/password.

Thanks,
Dan
0
Comment
Question by:DanTartaglia
  • 2
4 Comments
 
LVL 76

Assisted Solution

by:arnold
arnold earned 167 total points
Comment Utility
Not sure about c#, what about powershell? There are many examples including vbscript.
Within c# you would run net use to map a drive to a unc
http://www.c-sharpcorner.com/UploadFile/DipalChoksi/ShellCommandsInCS12032005042031AM/ShellCommandsInCS.aspx
0
 
LVL 6

Accepted Solution

by:
netjgrnaut earned 333 total points
Comment Utility
...or run NET USE to connect to \\ServerName\IPC$ with a user and password specified.  Then you can write to the \\ServerName\Share of choice without having to map a drive.
0
 

Author Comment

by:DanTartaglia
Comment Utility
Thanks to both of you. I'll use the NET USE command one way or the other.
0
 
LVL 6

Assisted Solution

by:netjgrnaut
netjgrnaut earned 333 total points
Comment Utility
http://social.msdn.microsoft.com/Forums/pl-PL/winforms/thread/a8ccaacb-85c2-4129-a55f-748c4bff3cf5

You might find that discussion helpful, if you want to go the C# route...
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Over the past decade, as Internet security has become a chief concern of IT professionals, one of the most common questions administrators and users ask is, “Which is more secure, SFTP or FTPS?” In short, both file transfer protocols offer a high…
The password reset disk is often mentioned as the best solution to deal with the lost Windows password problem. In Windows 2008, 7, Vista and XP, a password reset disk can be easily created. But besides Windows 7/Vista/XP, Windows Server 2008 and ot…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now