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

Discussion in 'ASP .Net' started by Edwin Knoppert, Dec 30, 2005.

  1. 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?
    Edwin Knoppert, Dec 30, 2005
    #1
    1. Advertising

  2. Edwin Knoppert

    Joerg Jooss Guest

    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?

    --
    Joerg Jooss
    Joerg Jooss, Jan 1, 2006
    #2
    1. Advertising

  3. 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.

    :)


    "Joerg Jooss" <> schreef in bericht
    news:...
    > 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?
    >
    > --
    > Joerg Jooss
    >
    >
    >
    Edwin Knoppert, Jan 1, 2006
    #3
  4. Edwin Knoppert

    Joerg Jooss Guest

    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,
    --
    Joerg Jooss
    Joerg Jooss, Jan 2, 2006
    #4
  5. 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.



    "Joerg Jooss" <> schreef in bericht
    news:...
    > 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,
    > --
    > Joerg Jooss
    >
    >
    >
    Edwin Knoppert, Jan 6, 2006
    #5
  6. Hmm, i just rewrote it to:

    http://66.249.93.104/search?q=cache...SPtoHTML.asp GetResponseStream ASP..NET&hl=nl

    And it seems to work as intended :)
    Testing...


    "Edwin Knoppert" <> schreef in bericht
    news:43be6733$0$10087$...
    >
    > 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.
    >
    >
    >
    > "Joerg Jooss" <> schreef in bericht
    > news:...
    >> 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,
    >> --
    >> Joerg Jooss
    >>
    >>
    >>

    >
    >
    Edwin Knoppert, Jan 6, 2006
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. EdDev
    Replies:
    1
    Views:
    2,495
    Victor Bazarov
    Sep 15, 2004
  2. parsifal
    Replies:
    0
    Views:
    290
    parsifal
    Jun 15, 2007
  3. sweetheart89115
    Replies:
    0
    Views:
    343
    sweetheart89115
    Oct 31, 2007
  4. Sunny Mohan
    Replies:
    0
    Views:
    210
    Sunny Mohan
    Apr 5, 2004
  5. Chris Baker
    Replies:
    3
    Views:
    154
    Patrice
    Jan 3, 2006
Loading...

Share This Page