Dir of UNC path passing credentials... .Net 2.0 3.0 or 3.5

I have a program that needs to do a dir on a unc path.  This path will need username / password to get to.

How do I go about his in VB.Net?


Rog DManager Inforamtion SystemsAsked:
Who is Participating?
wdosanjosConnect With a Mentor Commented:
You need to Impersonate the user in question.  Please check the sample code on the page below.  Your dir code should go in the Using impersonatedUser As WindowsImpersonationContext = newId.Impersonate() block.  Remove all the Console.Write and you should be good to go.


I hope this helps.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.