A
André Heuer
Hi,
i want to write a .net class that can update my ip address at the dyndns
service (http://www.dyndns.org).
When I open the page
https://username:[email protected]&myip=MyCurrentIpHere&wildcard=on
i get the response
nochg 80.146.122.175
which means "No change". IP hasn´t changed. Fine.
I wrote this code in my c# class:
public void UpdateIP(IPAddress ip)
{
const string UPDATE_URL =
"https://<USER>:<PWD>@members.dyndns.org/nic/update?system=dyndns&hostname=<
HOST>&myip=<IP>&wildcard=<WILDCARD>";
string url = UPDATE_URL;
url = url.Replace("<USER>", mUsername);
url = url.Replace("<PWD>", mPassword);
url = url.Replace("<HOST>", mDomain);
url = url.Replace("<IP>", ip.ToString());
url = url.Replace("<WILDCARD>", mWildcard ? "on" : "off");
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Headers.Add("Cache-control", "no-cache");
request.Headers.Add("Pragma","no-cache");
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
string text = new StreamReader(response.GetResponseStream()).ReadToEnd();
}
I get the following error on the line "HttpWebResponse response =
(HttpWebResponse)request.GetResponse();":
'System.Net.WebException' in system.dll
Remote Server returned an error (403) Unzulässig.
What is the difference betwenn the browser and my code? Any ideas?
Tia
André Heuer
i want to write a .net class that can update my ip address at the dyndns
service (http://www.dyndns.org).
When I open the page
https://username:[email protected]&myip=MyCurrentIpHere&wildcard=on
i get the response
nochg 80.146.122.175
which means "No change". IP hasn´t changed. Fine.
I wrote this code in my c# class:
public void UpdateIP(IPAddress ip)
{
const string UPDATE_URL =
"https://<USER>:<PWD>@members.dyndns.org/nic/update?system=dyndns&hostname=<
HOST>&myip=<IP>&wildcard=<WILDCARD>";
string url = UPDATE_URL;
url = url.Replace("<USER>", mUsername);
url = url.Replace("<PWD>", mPassword);
url = url.Replace("<HOST>", mDomain);
url = url.Replace("<IP>", ip.ToString());
url = url.Replace("<WILDCARD>", mWildcard ? "on" : "off");
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Headers.Add("Cache-control", "no-cache");
request.Headers.Add("Pragma","no-cache");
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
string text = new StreamReader(response.GetResponseStream()).ReadToEnd();
}
I get the following error on the line "HttpWebResponse response =
(HttpWebResponse)request.GetResponse();":
'System.Net.WebException' in system.dll
Remote Server returned an error (403) Unzulässig.
What is the difference betwenn the browser and my code? Any ideas?
Tia
André Heuer