473,382 Members | 1,423 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

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 4083
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: TJO | last post by:
Can someone at MS please reply to this. I am trying to post data so a web form via ssl with the following code. I keep getting this error: "The underlying connection was closed: Could not...
3
by: ME | last post by:
Hi; I am getting "Unhandled Exception: System.Net.WebException: The remote server returned an erro r: (401) Unauthorized." when I am trying to get a page via post. Code follows...
4
by: supster | last post by:
Hello, I am trying to use HttpWebRequest to simulate sending some POST data from a form to a PHP script. I have accomplished this using: HttpWebRequest req = (HttpWebRequest)...
5
by: Tammy | last post by:
Hi, I have an aspx app which needs to post data to a form and read the response. I am confused on whether I should be using the get_url using "POST" method or the post_url using "GET" method. ...
6
by: someone | last post by:
I am in a situation where I need to package some information from Page1, submit it via POST to another server which will process the information and then send the user to another page on my server...
7
by: | last post by:
Hello, I would like to do the following from a asp.net button click: <form method="POST" action="https://www.1234.com/trans_center/gateway/direct.cgi"> <input type="hidden" name="Merchant"...
4
by: Natalia | last post by:
Hello, I need to provide the ability to post file and some form elements via our website (asp.net) to the third party website (asp page). On http://aspalliance.com/236#Page4 - I found great...
0
by: barrybevel | last post by:
Hi, I'm trying to login to the www.vodafone.ie website using HttpWebRequest. It works fine with IE/Firefox and the .NET Web Control too, just not with my code. I think it's a redirect 302...
6
by: cethie | last post by:
In the code below, DoGet is working very stable. But DoPost throws an uncatcheable InvalidOperationException randomly. I am lost. Any pointers will be of immense help. /* Environment...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.