Click here to Skip to main content
15,912,329 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a small program which tries to save a file in network shared drive.
It will successfully save , if I login to that server once by myself using username password. The server is joined to domain as well as mine. I don't need to type domain name while i access the files on that server. I just use username and password.

If I restart my pc and try to run the program again, it will show error as the credentials haven't stored in my PC.

i want to include the username and password in my code .
how I do.?

I want to show screenshots in the forum how I do.?

What I have tried:

xlWorkBook.SaveAs(Filename:="\\10.51.199.49\log\CHANN SOFTWARE\test.xlsx", FileFormat:=51, ReadOnlyRecommended:=False, CreateBackup:=False)
Posted
Updated 13-Jul-16 23:18pm

1 solution

The feature you need is called Impersonation.
You can find several examples on StackOverflow etc., and also an article here on CP: A small C# Class for impersonating a User[^].
 
Share this answer
 
Comments
vivianpinto 16-Jul-16 0:34am    
Thank you Bernhard Hiller,

I am not familiar with C#

I am looking vb.net solution.

Thank you

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900