post variable

Discussion in 'ASP General' started by crowl@gmx.de, May 18, 2005.

  1. Guest

    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.
     
    , May 18, 2005
    #1
    1. Advertising

  2. 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"
     
    Bob Barrows [MVP], May 18, 2005
    #2
    1. Advertising

  3. Guest

    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.
     
    , May 19, 2005
    #3
  4. 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"
     
    Bob Barrows [MVP], May 19, 2005
    #4
  5. Guest

    > 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.
     
    , May 19, 2005
    #5
  6. Patrice Guest

    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

    --

    <> a écrit dans le message de
    news:...
    > > 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, May 19, 2005
    #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. Oleg
    Replies:
    0
    Views:
    1,196
  2. Sridhar Hegde
    Replies:
    2
    Views:
    2,547
    Ajeetha Kumari
    Sep 13, 2004
  3. Ron

    Variable = Variable? (re post)

    Ron, Jul 21, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    401
  4. mfglinux
    Replies:
    11
    Views:
    726
    Roberto Bonvallet
    Sep 12, 2007
  5. David Filmer
    Replies:
    19
    Views:
    257
    Kevin Collins
    May 21, 2004
Loading...

Share This Page