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 / Languages / C# / November 2007

Tip: Looking for answers? Try searching our database.

Problem Accessing Network Drives (Network Authentication)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
martin lanny - 29 Nov 2007 15:10 GMT
My application should periodically connect to multiple network drives to
see if the certain files were created.

I would do this to retrieve the list of files in UNC path //server1/backup/:

----------------------------------
Folder = "//server1/backup/"
Dim listoffiles As New List(Of System.IO.FileInfo)
listoffiles.AddRange(New System.IO.DirectoryInfo(Folder).GetFiles())
----------------------------------

This doesn't work though, because network drive expects network
credentials to be passed.

If I opened the same path (//server1/backup/) in windows explorer, it
would ask me for name and password, but the code above doesn't do any of
that, it just tells me that the drive doesn't exist.

Is there any way to pass network credentials programmatically?

I spent 3 days searching all over the Internet trying to find an answer,
but it seems dot net simply doesn't have any other option than mapping
the drive. I tried 3-4 of those mapping solutions, but neither worked
reliably.

All I want is to access network path (unc) using network credentials, if
there is no way to do so in dot net it would really be a sad discovery.

Joe
martin lanny - 29 Nov 2007 20:13 GMT
I am planning on writing a blog entry about limitations of .net 2003/2005.
Microsoft support, can you please confirm, that this is not possible?
Trevor Benedict - 30 Nov 2007 01:06 GMT
The example being a ASP.NET example. Not sure if it might be of help, but explains what has to be done.

Regards,

Trevor Benedict
MCSD
 "Trevor Benedict" <TrevorNews@yahoo.com> wrote in message news:...
 You could use this sample

 http://support.microsoft.com/kb/306158

 Regards,

 Trevor Benedict

 MCSD

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.