8 |
|
using System.IO; |
9 |
|
using System.Net; |
10 |
|
using System.Text; |
11 |
– |
#if !_FreeBSD_ |
12 |
– |
using System.Windows.Forms; |
13 |
– |
#endif |
11 |
|
|
12 |
|
public class HostUpdateSharp |
13 |
|
{ |
29 |
|
host.Append(".local.douglasthrift.net"); |
30 |
|
} |
31 |
|
|
32 |
+ |
CredentialCache cache = new CredentialCache(); |
33 |
+ |
|
34 |
+ |
cache.Add(new Uri(url), "Basic", new NetworkCredential("HostUpdate", |
35 |
+ |
"frell2003")); |
36 |
+ |
|
37 |
|
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); |
38 |
|
|
39 |
|
request.Accept = "text/plain"; |
40 |
|
request.ContentLength = host.Length; |
41 |
|
request.ContentType = "application/x-www-form-urlencoded"; |
42 |
< |
request.Credentials = new NetworkCredential("HostUpdate", "frell2003"); |
42 |
> |
request.Credentials = cache; |
43 |
|
request.KeepAlive = false; |
44 |
|
request.Method = "POST"; |
45 |
|
request.PreAuthenticate = true; |