Bad Request (Invalid HostName)

J

Juniormax

Hi!

I have a website at "http://domainXPTO.net" and I'm triying to access
the website in a C#.NET method running in my PDA.

I can access the WebService page in
"http://domainXPTO.net/service.asmx" several times with direct HTTP
calls, following one AND ONLY ONE sucessfull call to any WebMethod.

After that, nothing works!
All other direct HTTP calls or WebMethod calls return:
"Bad Request (Invalid HostName)"

I replicated the website environment in my local PC (both IIS website
and SQL Server database) and everything works fine. When I deploy it to
production in JodoHost... BUMM!

I'll try to explain my self by sending the PDA C# code...

Heres the C# code
--------------------------------------------------------
01. const string WEB_SERVICE_URL
02. = "http://domainXPTO.net/service.asmx";
03. public static void Main(string[] args) {
04. try {
05. WebCentral.Service wc = new WebCentral.Service();
06. wc.Url = WEB_SERVICE_URL;
07. string html;
08. html = Apl.Utils.Net.GetHtml(WEB_SERVICE_URL);
09. html = Apl.Utils.Net.GetHtml(WEB_SERVICE_URL);
10. WebCentral.PdaInfo pi = wc.GetPdaInfo("1234567890");
11. html = Apl.Utils.Net.GetHtml(WEB_SERVICE_URL);
12. html = Apl.Utils.Net.GetHtml(WEB_SERVICE_URL);
13. } catch (System.Net.WebException ex) {
14. string html2 = Apl.Utils.Net.GetHtml
15. ((HttpWebResponse)ex.Response);
16. }
17. }

The code never reaches line 12. The imediate HTTP call (line 11) after
the sucessfull WebMethod call (line 10) throws a WebException with the
server error 400: Bad Request (Invalid HostName).

If I try executing two exact WebMethods in a row, the first is
sucessfull and the second blows with the same "(Invalid HostName)".

It seems like the server gets busy with the first WebMethod call and
then redirects all of the other HTTP calls (text and soap) to a
diferent server with another name. Because the request's HTTP header
doesn't have the second server "HostName" the HTTP request is denied.
Just a wild guess :) Any clues?

Just some other infos:
1. If I try this code in a Windows Forms .NET application it seems to
works fine, only the PDA version doesn't work.
2. In my local development environment the two versions work fine.

Thanks
Forge Fonseca
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top