I have set up a URL redirect on http://freedns.afraid.org/ so I can change host to a file that my application downloads, without the need of changing the code in my app.
The problem is that I need to resolve the correct URL before downloading the file. I tried a method I found here at SO but it didn't work (Webrequest).
So I suppose that they don't use a common redirect.
How can you resolve the real url/ip?
UPDATE:
I have another subdomain over at freedns, and if you do a downloadstring on that one you get the page that it should redirect to. Maybe that info can be to any help.
UPDATE2:
Here is the code I use to fetch the other webpage:
WebClient client = new WebClient();
string xml = client.DownloadString(new Uri("myfreednshere"));
So by running that code, I get the string of the webpage b, that the "myfreednshere" redirects to.
Which means that the webclient succeeds in resolving the url redirect. Is there any code that I can use that just resolves the redirect?
UPDATE3:
This is the response I get with a httprequest:
{X-Abuse: URL redirection provided by freedns.afraid.org - please report any misuse of this service
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Cache-Control: public, max-age=15
Content-Type: text/html
Date: Wed, 09 Nov 2011 21:55:21 GMT
Server: Apache/1.3.41 (Unix) PHP/5.3.6 with Suhosin-Patch
X-Powered-By: PHP/5.3.6
}
I've noticed that at least one afraid.org site (http://fb.afraid.org, the only domain I could get to work with a quick check) does not use HTTP redirection, 301 redirects, or proxying. It uses frames. So, your original code should work:
WebClient client = new WebClient();
string xml = client.DownloadString(new Uri("myfreednshere"));
With a little modification, I used this code:
WebClient client = new WebClient();
string html = client.DownloadString(new Uri("http://fb.afraid.org"));
the result of the call had the real url (http://www.fragbite.com) in three places, once in a comment, once in a frame source, and once in a link in the noframes tag. You should be able to parse the url out if you need it programatically.