Solved

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

Posted on 2011-03-08
1
739 Views
Last Modified: 2012-05-11
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?

Thanks,

Rog
0
Comment
Question by:Rog
1 Comment
 
LVL 23

Accepted Solution

by:
wdosanjos earned 500 total points
ID: 35073657
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.

http://msdn.microsoft.com/en-us/library/w070t6ka.aspx

I hope this helps.
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

778 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