Problem with webrequest

  • Thread starter Thread starter Tommy Martin
  • Start date Start date
T

Tommy Martin

In my project I need to get an XML document at a web address and save it
here for use in another part of the program. If I enter the address in my
browser I can see the xml just fine. If I use this code the data is
encrypted. It is encrypted on the web site but I assume the cgi that
displays it uncompresses on the fly.

How can I make this happen in my code so I can get the uncompressed XML?

Thanks in advance for any help.

Tommy


Dim objResponse As WebResponse

Dim objRequest As WebRequest

objRequest =
System.Net.HttpWebRequest.Create("http://setiboinc.ssl.berkeley.edu/ap/stats
/user_total_credit_0.gz")

objResponse = objRequest.GetResponse()

Dim oSR As New StreamReader(objResponse.GetResponseStream())

cResult = oSR.ReadToEnd()

oSR.Close()

MsgBox(cResult)
 
Incidently... This code works just fine with a normal web page. It is
something related to the fact that the data is compressed on the server.

Thanks again...
Tommy
 
Hi Tommy,

You're right about the reason. These are some of the headers:

<Server> Apache/1.3.27 (Unix) mod_fastcgi/2.4.0 PHP/4.3.2
<Last-Modified> Mon, 03 Nov 2003 05:00:03 GMT
<ETag> "13ce6-49fe-3fa5e0d3"
<Content-Length> 18942
<Content-Type> application/octet-stream
<Content-Encoding> x-gzip

It's the browser that does the decompression. But the <how> is for someone
else to tell you, I'm afraid.

Regards,
Fergus
 
Hi Tommy,

You're right about the reason. These are some of the headers:

<Server> Apache/1.3.27 (Unix) mod_fastcgi/2.4.0 PHP/4.3.2
<Last-Modified> Mon, 03 Nov 2003 05:00:03 GMT
<ETag> "13ce6-49fe-3fa5e0d3"
<Content-Length> 18942
<Content-Type> application/octet-stream
<Content-Encoding> x-gzip

It's the browser that does the decompression. But the <how> is for someone
else to tell you, I'm afraid.

Regards,
Fergus

Can't give a lot of specifics, but the OP may want to look into using
the ziplib from http://www.icsharpcode.net. It handles gzip just fine.
In fact, looking down the page there is a link for a
HttpCompressionModule for ASP.NET that is based on the ziplib.

HTH
 
Back
Top