post variable

C

crowl

I have a VB application sending data via post to an ASP page.

The application sends two variable: id, txt

If txt has the & sign in its string, it cause trouble. E.g.:
id = 1
txt = "Hello & more"

If I take a look into Request.Form() array in asp page, it shows the
following:
id = 1
txt = "Hello "
more = ""

I guess I have to encode the txt variable in my VB application and
uncode it on the receiving part. Wondering that I can not pass variable
like "Hello & more" directly via post to an asp page. Is there any
change to get the right content from txt without modify the VB
application?

Thanks for help.
 
B

Bob Barrows [MVP]

I have a VB application sending data via post to an ASP page.

The application sends two variable: id, txt

If txt has the & sign in its string, it cause trouble. E.g.:
id = 1
txt = "Hello & more"

If I take a look into Request.Form() array in asp page, it shows the
following:
id = 1
txt = "Hello "
more = ""

I guess I have to encode the txt variable in my VB application and
uncode it on the receiving part. Wondering that I can not pass
variable like "Hello & more" directly via post to an asp page. Is
there any change to get the right content from txt without modify the
VB application?

Thanks for help.

Given that this test produces the expected results:
<%
for each key in Request.Form
Response.Write key & ": " & Request.Form(key) & "<BR>"
next
%>
<HTML>
<BODY>

<FORM action="" method=POST id=form1 name=form1>
<INPUT type="text" id=text1 name=id value="1">
<INPUT type="text" id=text2 name=txt value="this text & More text">
<INPUT type="submit" value="Submit" id=submit1 name=submit1>
</FORM>

</BODY>
</HTML>


I have to say that the method you are using to post the data is causing the
problem. What are you using to post the data? XMLHTTP? Something else? Let's
see a little code to help us reproduce the problem.

Bob Barrows
 
C

crowl

Hi Bob,
I have to say that the method you are using to post the data causing
the problem.

You are probably right. Then I am here in the wrong group. However, if
someone want help me, here is the code from my VB application:

szPostData = "id=" & strID & "&" & "txt=" & strText
myInet.Execute , "POST", szPostData, _
"Content-Type:
application/x-www-form-urlencoded"

I guess this is because I'm using application/x-www-form-urlencoded.
Are there exist other types then application/x-www-form-urlencoded
which can be used together with inet control? I checked the docs, but
was unable to find anything usable. Or have I to urlencode my
szPostData and uncode it on the asp site (worst case for me)?

Thank you for help.
 
B

Bob Barrows [MVP]

Hi Bob,


You are probably right. Then I am here in the wrong group. However, if
someone want help me, here is the code from my VB application:

szPostData = "id=" & strID & "&" & "txt=" & strText
myInet.Execute , "POST", szPostData, _
"Content-Type:
application/x-www-form-urlencoded"

I guess this is because I'm using application/x-www-form-urlencoded.
Are there exist other types then application/x-www-form-urlencoded
which can be used together with inet control? I checked the docs, but
was unable to find anything usable. Or have I to urlencode my
szPostData and uncode it on the asp site (worst case for me)?

Thank you for help.


What is myInet? There are several components out there that enable you to
post data to asp pages ...

I've had good success using the XMLHTTPRequest object that comes with the
MSXML parser.

Bob Barrows
 
C

crowl

What is myInet?

Sorry I forgot to mention this very important point. It is VB6 inet
control. The apptlication is written in VB6. In fact, this application
was original written in 1998. So all of its client server communication
is based on this inet control.
 
P

Patrice

Try to encode the & using for example &amp;

Not familiar with the raw level format but it's likely that fields are
posted using name1=value1&name2=value2 and that's conflict with your use of
&.

In the worst case see the RFC or see how an HTML page encodes this (using
Request.BinaryRead) so that you can stuff your variable with the appropriate
replacement for the & character...

Patrice

--
 

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,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top