Request received well, returning it results in loss of data!

E

Edwin Knoppert

I'm doing a simple test, about 100 lines of data of ~200 bytes each.
I'm using WebRequest() and HttpWebResponse() calling a generic handler.

What i pass to the webserver (tried local as not local) i return directly
using Response.Write() per line.
The server receives the data 100% ok.

Both client as server use application/x-www-form-urlencoded.
The data is sent as POST and is ASCII encoded.
item1=data.... etc..

In the handler a loop for each item is used and sent with Response.Write().
Each item is seprated using &
Using 2 local VWD projects results in having up to item #52 being correct.
The rest is gone.
The non-local webserver return only 8 items!!

The oddity is that Response.flush results in no items.
Is this a timing issue?
 
J

Joerg Jooss

Hello Edwin,
I'm doing a simple test, about 100 lines of data of ~200 bytes each.
I'm using WebRequest() and HttpWebResponse() calling a generic
handler.

What i pass to the webserver (tried local as not local) i return
directly
using Response.Write() per line.
The server receives the data 100% ok.
Both client as server use application/x-www-form-urlencoded. The data
is sent as POST and is ASCII encoded. item1=data.... etc..

In the handler a loop for each item is used and sent with
Response.Write().
Each item is seprated using &
Using 2 local VWD projects results in having up to item #52 being
correct.
The rest is gone.
The non-local webserver return only 8 items!!
The oddity is that Response.flush results in no items. Is this a
timing issue?

Can you post your code?
 
E

Edwin Knoppert

That would be difficult at this time.
However, these are two apps using urlencoding (item=data...) etc
I use a generic handler and return the same date immediately.

If you insist on code.. i have to make something i can release then.

:)
 
J

Joerg Jooss

Hello Edwin,
That would be difficult at this time.
However, these are two apps using urlencoding (item=data...) etc
I use a generic handler and return the same date immediately.
If you insist on code.. i have to make something i can release then.

Well, "insisting" is a pretty strong term, but I'd rather not blindly guess
;-)

Cheers,
 
E

Edwin Knoppert

Back again, i could manage a smaller fragment which obtains the response
data.
It should be enough to understand the problem imo.

We *respond* with "application/x-www-form-urlencoded"
In the ashx file i respond with: (the StrDup is not used, i tried sending a
byte array later on)

T = Microsoft.VisualBasic.Strings.StrDup(60000, "A")
.Response.Write("item1=len(T): " &
T.Length.ToString)
'.Response.Write("&item2=" & T)

Dim b(99999) As Byte
For nItem As Int32 = 0 To b.Length - 1
b(nItem) = 65
Next
.Response.Write("&item2=")
.Response.BinaryWrite(b)


ContentLength is: 100026


Dim nLen As Int32 = oHTTPResponse.ContentLength
If nLen > 0 Then

ReDim data(nLen - 1)
oStream = oHTTPResponse.GetResponseStream()
oStream.Read(data, 0, nLen)
oStream.Close()
oStream.Dispose()
oStream = Nothing

Dim a As Int32
Dim nItem As Int32

For nItem = 0 To data.Length - 1
If data(nItem) = 0 Then
Stop
Exit For
End If

Next


The for/next loop stops at: 8760

As you see it's no a decoding issue, i guess the data is chunked internally
and due some reason char 0 is inserted or so.
 

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

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top