Link to home
Start Free TrialLog in
Avatar of PantoffelSlippers
PantoffelSlippersFlag for South Africa

asked on

Authentication using the NetworkCredential class in .Net

Hi

I'm trying to write an application that reads files off a network share.  The problem is that the domain requires authentication before the application may access the share.  I'm trying to use the NetworkCredential class to automate this.  I have the appropriate username and password.

Please assist me in using the Network Credential class to achieve this.

I have attached some code

Thanks

'Dim NetC As New System.Net.NetworkCredential
 
        'NetC.Domain = "PRODDOM"
        'NetC.UserName = "admin-s1038920"
        'NetC.Password = "YY9hJ90!hH$"
 
 
         --This prompts for username and password
        Chart1.SaveImage(My.Settings.ImageTargetPath & My.Settings.SaveToImageName, _
                         DataVisualization.Charting.ChartImageFormat.Jpeg)

Open in new window

Avatar of PantoffelSlippers
PantoffelSlippers
Flag of South Africa image

ASKER

Anyone?
Avatar of Bob Learned
Are you talking about impersonation?
TheLearnedOne,

To be honest with you:  I don't know.

I basically don't know what could be a solution for me.

All I'm looking to do is programmtically access a shared folder.

If authentication is required then my code needs to provide it automatically.

If impersonation can help me achieve that then yes, we can have a look at impersonation.

I've just read a couple of articles on impersonation and it seems as if it could be what I'm looking for!
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you TheLearnedOne,

I was unfamiliar with Impersonation up until now.

Well, I still am but at least now I know about it.

I'll check out the link  - maybe it'll solve my problem.

Post back soon

Thanks
Thanks