Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP General (http://www.velocityreviews.com/forums/f65-asp-general.html)
-   -   post variable (http://www.velocityreviews.com/forums/t798748-post-variable.html)

crowl@gmx.de 05-18-2005 12:52 PM

post variable
 
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.


Bob Barrows [MVP] 05-18-2005 04:15 PM

Re: post variable
 
crowl@gmx.de wrote:
> 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

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"



crowl@gmx.de 05-19-2005 07:30 AM

Re: post variable
 
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.


Bob Barrows [MVP] 05-19-2005 11:03 AM

Re: post variable
 
crowl@gmx.de wrote:
> 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.



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

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"



crowl@gmx.de 05-19-2005 02:31 PM

Re: post variable
 
> 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.


Patrice 05-19-2005 02:42 PM

Re: post variable
 
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

--

<crowl@gmx.de> a écrit dans le message de
news:1116513094.165842.281610@f14g2000cwb.googlegr oups.com...
> > 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.
>





All times are GMT. The time now is 03:40 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.