469,910 Members | 1,553 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,910 developers. It's quick & easy.

POST data by HttpWebRequest - very strange sytuation

Hi,

I have very strange situation but first description ;)
I have:
1) project in VB.NET, in this f.e. 1 function:

Public Function Login(ByVal UserName As String, ByVal UserPassword As
String, Optional ByVal ConnectionParamList As String = Nothing) As
String

this function use HttpWebRequest to connect to asp site on the server:

httpRequest = HttpWebRequest.Create(url)
httpRequest.Method = "POST"
httpRequest.AllowWriteStreamBuffering = True
httpRequest.Timeout = 6000000
httpRequest.SendChunked = True
httpRequest.ContentLength = Content.Length
httpRequest.Credentials =
System.Net.CredentialCache.DefaultCredentials
....
input = httpRequest.GetRequestStream()

Try
If input.CanWrite Then
If Content.Length 0 Then
input.Write(Content, 0, Content.Length)
End If
input.Flush()
End If
Finally
input.Close()
End Try

'communication
httpResponse = httpRequest.GetResponse()
... (next StringBuilder and return result)

2) i have project in C#, where i call this Login(...)

result = myObject.Login("loginName", "password",
"some_parameters_as_URL_etc");

3) i have COM+ project in VB6 where i call Login function too (with the
same parameters like in project 2):

rv = myObject.Login(ExternalUserName, ExternalPassword,
ConnectionParams)

And now something strange:

when i call Login from project 2), the communication betwen server with
asp site look like this:

--- START ---

POST /ddd/odbc.asp HTTP/1.1
Content-Length: 133
Expect: 100-continue
Connection: Keep-Alive
Host: 192.168.1.48
HTTP/1.1 100 Continue
Server: Microsoft-IIS/5.1
Date: Sat, 26 Aug 2006 16:00:46 GMT
X-Powered-By: ASP.NET

<TRANSMISION><ACTION>Login</ACTION><PARAMS><LOGIN>John</LOGIN><PASSWORD>Smith</PASSWORD><DBNAME>Northwind</DBNAME></PARAMS></TRANSMISION>HTTP/1.1
200 OK

Server: Microsoft-IIS/5.1
Date: Sat, 26 Aug 2006 16:00:46 GMT
X-Powered-By: ASP.NET
Content-Length: 19
Content-Type: text/xml; Charset=utf-8
Set-Cookie: ASPSESSIONIDCACBDCBR=AABBPADAGMPPMBKBBCFMFOON; path=/
Cache-control: No-cache

<RESULT>OK</RESULT>

--- END ---

<TRANSMISIONand <RESULTis data whith i sending and receiving and
this is OK

but when i call Login from project described in 3), communication looks
like this:

--- START ---

POST /ddd/odbc.asp HTTP/1.1
Host: 192.168.1.48
Transfer-Encoding: chunked
Expect: 100-continue
HTTP/1.1 100 Continue
Server: Microsoft-IIS/5.1
Date: Sat, 26 Aug 2006 15:15:45 GMT
X-Powered-By: ASP.NET

85
<TRANSMISION><ACTION>Login</ACTION><PARAMS><LOGIN>John</LOGIN><PASSWORD>Smith</PASSWORD><DBNAME>Northwind</DBNAME></PARAMS></TRANSMISION>
0

HTTP/1.1 200 OK
Server: Microsoft-IIS/5.1
Date: Sat, 26 Aug 2006 15:15:45 GMT
X-Powered-By: ASP.NET
Content-Length: 46
Content-Type: text/xml; Charset=utf-8
Set-Cookie: ASPSESSIONIDCACBDCBR=OPABPADAJOABBJAFDLFNJAHE; path=/
Cache-control: No-cache

<RESULT>ERROR: invalid XML in request</RESULT>

--- END ---

Question is:
WHAT IS THIS "85" before sendet XML and "0" after it !?

i search internet and found nothing :/

if someone know something or had similar situation, pleas help me ;)

Best regards,
Peter

Aug 26 '06 #1
2 3923
OK, i resolve this problem.
if i comment line:
httpRequest.SendChunked = True
everything works fine.

Why ? i dont know ;)

Regards,
Peter

Aug 28 '06 #2
Question is:
WHAT IS THIS "85" before sendet XML and "0" after it !?
You're using chunked-encoding.

Chunked is used when you want to send data between a client and a server
and the receiver wants to start consuming the data before it's all been
sent. Chunked allows the sender to send the data without knowing how
large it is, so the sender doesn't need to calculate the data's size
then set the Content-Length header.

The '85' before the data says: "The size of the next chunk is 85(hex)
bytes. The '0' indicates there is no more data being sent, i.e. this was
the last chunk.

See the HTTP RFC for more details (http://rfc.net/rfc2616.html)

Kevin Jones
Aug 28 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by TJO | last post: by
4 posts views Thread by supster | last post: by
6 posts views Thread by someone | last post: by
6 posts views Thread by cethie | last post: by
1 post views Thread by Waqarahmed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.