HTTPWebRequest: framework vs. compact framework


G

Guest

Hello

i have a problem with HTTPWebRequest and WM2003. The following cod
runs fine on my pc. On the PPC with WM2003 or the emulator the code wil
not work ("The chunk length was not valid")

Have anybody an idea

Thx: - Reinhard


Public Function GetHTMLPage(ByVal URL As String) As Strin

Dim sResult As Strin

Dim objRequest As HttpWebReques
Dim objResponse As HttpWebRespons

Tr

objRequest = System.Net.HttpWebRequest.Create(URL

objRequest.Method = "GET
objRequest.Timeout = 6000

objResponse = objRequest.GetResponse(

Dim sr As System.IO.StreamReader = New System.IO.StreamReader(objResponse.GetResponseStream(), System.Text.Encoding.Default

'this will NOT work on WM200
sResult = sr.ReadToEnd(

sr.Close(

objResponse.Close(

Return sResul

Catch ex As WebExceptio

MsgBox("Web: " & ex.Message

txtResults.Text = "

objResponse = Nothin
objRequest = Nothin

Catch ex As System.Exceptio

MsgBox("System: " & ex.Message

txtResults.Text = "

objResponse = Nothin
objRequest = Nothin

End Tr

End Functio
 
Ad

Advertisements

J

Jonathan Wells [msft]

Hi Reinhard, are you running SP2? If not give it a try, many users have
reported that SP2 has fixed this problem for them:
http://msdn.microsoft.com/mobility/downloads/updates/default.aspx

You can also browse through these threads for more information on the
problem:
http://groups.google.com/groups?q=c...+length&hl=en&lr=&ie=UTF-8&oe=UTF-8&scoring=d

cheers jono
--
Jonathan Wells
Product Manager
..NET Compact Framework
Check out the .NET Compact Framework FAQ at:
http://msdn.microsoft.com/mobility/prodtechinfo/devtools/netcf/FAQ/default.aspx

This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Guest

Hallo Jonathan

i have installed the SP2 and my program runs now on WM2003! Than
you for this ..

But the program runs NOT on the emulator (german ppc 2003 sdk) wit
SP2. Have you any suggestions, what i can do

Thx: - Reinhard
 
M

Mike

Are you sure SP2 is on the emulator? Shouldn't matter if it's on an
emulator or device.
 
Ad

Advertisements

M

Mike

The only thing different in my code is the encoding...

myStream = myResponse.GetResponseStream()

encode = System.Text.Encoding.GetEncoding("utf-8")

' Pipe the stream to a higher level stream reader with the required encoding
format.

readStream = New System.IO.StreamReader(myStream, encode)

strLists = readStream.ReadToEnd()

' Release the resources of stream object.

readStream.Close()
 

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