C # How to save password in application

I am trying to write an application that will automatically download one page from the Sharepoint server every hour. This is an xml file. Everything still works, except that I don’t like to store the password needed to connect to Sharepoint in text form in my application. Sample code here:

WebClient client = new WebClient();
String username = "myusername";
String password = "mypassword"
String filename = "C:\\Temp\\" + DateTime.Now.ToString("yyyyMMddHHmmssffff") + ".xml";

client.Credentials = new System.Net.NetworkCredential(username, password);
string credentials =  Convert.ToBase64String(Encoding.ASCII.GetBytes(username + ":" + password));
client.DownloadFile("myurl", filename);

Is there a way to make it harder to read my password if someone received an executable from my server and parsed it, for example. with a reflector?
I found this: How to store passwords in a Winforms application? but I really did not understand how to use it in my application.

+4
source share
2 answers

. , DefaultNetworkCredentials:

, :

client.Credentials = CredentialCache.DefaultNetworkCredentials;

, DOMAIN\USER.

+5

, , (), .

+1

All Articles