1 |
Douglas Thrift |
77 |
// Host Update Sharp |
2 |
|
|
// |
3 |
|
|
// Douglas Thrift |
4 |
|
|
// |
5 |
|
|
// $Id$ |
6 |
|
|
|
7 |
|
|
using System; |
8 |
|
|
using System.IO; |
9 |
|
|
using System.Net; |
10 |
Douglas Thrift |
82 |
using System.Text; |
11 |
Douglas Thrift |
77 |
|
12 |
Douglas Thrift |
78 |
public class HostUpdateSharp |
13 |
Douglas Thrift |
77 |
{ |
14 |
Douglas Thrift |
78 |
public static void Main(string[] args) |
15 |
Douglas Thrift |
77 |
{ |
16 |
Douglas Thrift |
82 |
StringBuilder host = new StringBuilder(Dns.GetHostName()); |
17 |
Douglas Thrift |
78 |
string url = "http://topsecret.douglasthrift.net/auth/hostupdate.cgi"; |
18 |
|
|
|
19 |
Douglas Thrift |
82 |
if (host.ToString().IndexOf('.') < 0) |
20 |
|
|
{ |
21 |
|
|
host.Append(".local.douglasthrift.net"); |
22 |
|
|
} |
23 |
|
|
|
24 |
|
|
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); |
25 |
|
|
|
26 |
|
|
request.Accept = "text/plain"; |
27 |
|
|
request.AllowAutoRedirect = false; |
28 |
|
|
request.ContentType = "application/x-www-form-urlencoded"; |
29 |
|
|
request.Credentials = new NetworkCredential("HostUpdate", "frell2003"); |
30 |
|
|
request.Method = "POST"; |
31 |
Douglas Thrift |
77 |
} |
32 |
|
|
} |