views:

109

answers:

2

I need to access to service from windows-client? that can be called by ajax - GET request. and returns XML

if i using HttpWebRequest request = HttpWebRequest.Create...

for ex url: http://site.com/UtilBillAjaxServlet?event=GET_PAMENT_CENT_DUE&SERVICEPROIDER=providername&SERVICETYPE=BROADBAND&CONSUMERNUMBER=195100601

And it return's 0-length response (in browser it retun correct response)

i think problem is - server detects that query as non-xhttp query (is there any difference?)

Thank you.

+2  A: 

You should use fiddler or any other sniffer for tracing that.

But for doing what you want just use the following: http://support.microsoft.com/default.aspx/kb/307023

Pablo Castilla
+1  A: 

It's possible that the service only responds to requests coming from a browser; I'd find that a little strange, but not unheard of.

However, if that is the case you can emulate a browser request:

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(yourUri);

// Pretend to be IE6!
request.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; windows NT 5.1)";
request.Method = "GET";
request.AllowAutoRedirect = true;
request.KeepAlive = true;
Mark B