Saturday, 15 January 2011

c# - Free webhosting not letting WebRequest get the page -


I am creating a chat application and I am using a free webhosting to store online users in a database I am I have the following structure:

1) index.php Where I find users online in this format:

  & lt ; Users & gt; & Lt; Name & gt; & Lt; / Name & gt; & Lt; IP & gt; & Lt; / IP & gt; & Lt; / User & gt;    

2) add.php? When the user = adds it, to add a new user to the database.

3) When it disconnects, remove the user from remove.php? User = .

Now in the application I have a function GetUsers () like this:

  string url = @ "http: // .. ./index.php "; System.Net.WebRequest req = System.Net.WebRequest.Create (url); System.Net.WebResponse res = (System.Net.WebResponse) req.GetResponse ();   

If I am using a local IIS server for URL, but when I try the free web hosted URL, then give me a 406 not acceptable error That's why I think I need to make some headers or some things to be a fake real browser.

Update: 1) Free hosting service is using Apache as a webserver 2) You can recommend another way to get the web page.

I suggest using a tool like capturing your browser's request, and then Trying to simulate in code.

You can root your programmatic requests through the use of technology through technology. Quick:

  req.prxy = new WebProxy ("http: // localhost: 8888", incorrect);   

Localhost: 8888 is the default address of the Fidler.

No comments:

Post a Comment