Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

[3272] POSTing Form Data to a Web Page

Last post 06-02-2007 11:14 PM by sameer.alone1. 32 replies.
Page 2 of 3 (33 items) < Previous 1 2 3 Next >
Sort Posts: Previous Next
  • 05-17-2004 2:08 PM In reply to

    • nickiler
    • Not Ranked
    • Joined on 05-17-2004
    • New Member
    • Points 5

    Emulate Form Post in C#

    How can this be done in C#? I tried to convert this solution and did not work.

    It seems the object was not created successfully. Can anyone help out in this?
    • Post Points: 0
  • Advertisement

    • Red Gate Software

    Advertisement

    Want to boost your .NET application performance?

    Some developers always seem to write efficient and lightening-fast code. What is their secret? It’s ANTS Profiler. “We improved the performance of the application up to 10 times” Dan Ports, Intrigma.

    Try it for yourself now.

  • 09-12-2004 10:04 AM In reply to

    • rucoding
    • Not Ranked
    • Joined on 09-12-2004
    • New Member
    • Points 5

    Can't get my ASP page to see post

    Thanks for this code sample, but I tried the VB code suggested, but my ASP page continues to say that no form data has been sent. I call my ASP page and send 1 parameter, then in my ASP page, I respond with this:

    Response.CacheControl = "no-cache"
    Response.AddHeader "Pragma", "no-cache"
    Response.Expires = -1

    Response.Write "Form Parameters (Submit method=POST):"

    For each reqItem in Request.Form
      Response.Write reqItem & "=" & Request.Form(reqItem) & "<br>"    
    Next

    However, no Request.Form items are written. Am I missing something?

    Thanks!
    • Post Points: 0
  • 09-21-2004 3:01 PM In reply to

    data acquisition

    I am trying to get certain data from a GPS web page so that it can be transimitted to a microcontroller and later to a pda

    any sugestions on what language I should use.

    • Post Points: 0
  • 01-21-2005 8:53 AM In reply to

    • jsuzuki
    • Not Ranked
    • Joined on 01-21-2005
    • New Member
    • Points 15

    ServerXMLHTTP

    Excellent summary on how to POST content to a webserver.

    I do have comment on the method that uses the ServerXMLHTTP.  In the line
    Code:
    xmlhttp.send "Id=1&S=2"

    I would change it to something like
    Code:
    dim PostStr as String: PostStr = "Id=1&S=2"
    xmlhttp.send (PostStr)


    Notice the parentheses around the variable PostStr.  Without it, 0-byte length content is sent.  Caused me a bit of grief as I tried to figure this out.  Hopefully this comment will save others some time.
    • Post Points: 0
  • 01-25-2005 10:49 PM In reply to

    Where's the URL?

    Maybe I'm just blind, but I've read through the API method a few times, and I can't see where in all that code you put the URL. I can only find the path.
    • Post Points: 0
  • 04-09-2005 9:51 AM In reply to

    • mdimran
    • Not Ranked
    • Joined on 04-09-2005
    • New Member
    • Points 5

    Posting multiline data from textarea control

    How do i post data contains carriage return character i.e., text from TEXTAREA control.
    • Post Points: 0
  • 06-02-2005 6:01 AM In reply to

    • nzKiwi
    • Not Ranked
    • Joined on 06-02-2005
    • New Member
    • Points 10

    POST and Redirect at same time

    Hello,

    I would like o use ServerXMLHTTP to POST data to a remote server and to also be redirected to that same page as if I am in a client browser and I clicked on the submit button of a form.  I don't know how to get ServerXMLHTTP to follow the POST when I send it.

    I understand that it returns a responseText object but when I write it out it displays a normal looking page but I am still sitting on my server rather than the server I tried POSTING too...

    I'm hoping there are some properties that I can set to do this...

    Any help would be much appreciated.

    Here is my code that I've been playing around with:

    <%@LANGUAGE="VBSCRIPT"%>
    Dim objHttp
    Dim str

    If Request.ServerVariables("Request_Method") = "POST" Then
       str = "cmd=_xclick&item_name=test&no_note=1¤cy_code=USD"

       'Declare OUR POST object
       Set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
       objHttp.Open "POST", "https://www.paypal.com/cgi-bin/webscr", FALSE
       objHttp.setRequestHeader "Host", "www.paypal.com"
       objHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
       objHttp.setRequestHeader "Content-Length", Len(str)
       objHttp.Send str

       Response.Write (objHttp.ResponseText)
    End If
    Set objHttp=nothing%>
    • Post Points: 0
  • 07-04-2005 11:35 AM In reply to

    • BardyL
    • Not Ranked
    • Joined on 07-04-2005
    • New Member
    • Points 15

    Post a "multipart/form-data" classical form

    How to  programmatically send in Asp.Net  a classic "multipart/form-data" form to a server?

    Hi everyone ,

    I've been searching for hours about a common Internet programming question and I'm certainly not the only one having the following problem :


    With .Net (be it Delphi or VB), I need to POST a form to a .php server. If I pass the following parameter to the request :
    objRequest.ContentType := 'application/x-www-form-urlencoded';

    everything works fine. Except that if I need to transmit special characters from the form - like for example french or german accents - those laters are not transmitted in the format waited by the server (ISO-8859-1). So when you send text to the server via this form, you get unreadable or not corresponding character on the server side. Changing the content type like this on the *.aspx form source code doesn't change anything :

    objRequest.ContentType := 'application/x-www-form-urlencoded; charset=ISO-8859-1';

    No more result if you modify the web.config by adding the following line :

    <globalization requestEncoding="ISO-8859-1" responseEncoding="ISO-8859-1" />

    Another solution I tried was to HTML encrypt the parameter string posted back to server with the following .Net method :

    FormString := HttpUtility.HtmlDecode(FormString);

    No way. It makes new problem because of the "&" parameter separator... If you have special characters, it adds "&" in the string. For example the e-cute accent (é) is converted into é HTML code and the #233; is then considered as a parameter...

    Some peolpe say that the content type "application/x-www-form-urlencoded" should not be used when you post a form. (there is also confusion between POST and GET method because usually you don't POST form be sending parameters into URL but this is another question). And I've remarked that actually, even if the server also accepts "application/x-www-form-urlencoded" form (certainly for compatibility reason), it is actually waiting for a "multipart/form-data" form. Posting form in "multipart/form-data" is also recommended by many people.

    So, here is my question : how in Asp.Net  to send programmatically to a server a classic "multipart/form-data" form containing characters of type ISO-8859-1 ? What must be the syntax of the string containing the content of the form and the request parameters ? With "application/x-www-form-urlencoded" form, the form parameter string is simple a line such as "parameter1=abc¶meter2=def". It doesn't work with "multipart/form-data" that encapsulate parameters between bounadaries. I found the following syntax exampe at http://www.faqs.org/rfcs/rfc2388.html but I don't succeed in applying it to my application :

       --AaB03x
       content-disposition: form-data; name="parameter1"
       content-type: text/plain;charset=ISO-8859-1
       content-transfer-encoding: quoted-printable

       abc
       --AaB03x--AaB03x
       content-disposition: form-data; name="parameter2"
       content-type: text/plain;charset=ISO-8859-1
       content-transfer-encoding: quoted-printable

       def
       --AaB03x


    There are plenty of information and examples about using the "multipart/form-data" form to upload file on a server but I couldn't find any about simply sending a classic form including text fields with special characters like accents. If one knows how to do that, it would be great if one could put a short example onto your site ! I think it could be very usefull for a lot of people !

    Thanks a lot for your precious attention!

    Laurent,
    Switzerland





    • Post Points: 0
  • 09-15-2005 7:36 AM In reply to

    Has anyone been able to find the solution of the above problem?
    if you have found the solution Bardyl , please email me at someone_chuss@yahoo.ca
    • Post Points: 0
  • 09-18-2005 6:30 AM In reply to

    • musalpay
    • Not Ranked
    • Joined on 09-18-2005
    • New Member
    • Points 5
    Quote:
    [1]Posted by jsuzuki on 21 Jan 2005 08:53 AM[/1]
    Excellent summary on how to POST content to a webserver.

    I do have comment on the method that uses the ServerXMLHTTP.  In the line
    Code:
    xmlhttp.send "Id=1&S=2"

    I would change it to something like
    Code:
    dim PostStr as String: PostStr = "Id=1&S=2"
    xmlhttp.send (PostStr)


    Notice the parentheses around the variable PostStr.  Without it, 0-byte length content is sent.  Caused me a bit of grief as I tried to figure this out.  Hopefully this comment will save others some time.


    Are you solve the problem. It does not work. I dont understand why.
    • Post Points: 0
  • 09-19-2005 8:41 PM In reply to

    • jsuzuki
    • Not Ranked
    • Joined on 01-21-2005
    • New Member
    • Points 15
    musalpay,

    Yes it works for me now.  Perhaps if you explain what isn't working, others can help.

    -jack
    • Post Points: 0
  • 09-23-2005 4:13 PM In reply to

    ReponseText property not supported

    I tried to get something out of the POST method by

    Text1.Text = xmlhttp.ReponseText

    but it says object's property/method not supported. also i can't find the ServerXMLHTTP class for MSXML2 in my libraries.. can anyone please tell me what is wrong with it..
    • Post Points: 0
  • 10-20-2005 3:21 AM In reply to

    • lmattos
    • Not Ranked
    • Joined on 10-20-2005
    • New Member
    • Points 5

    Did you find the solution to this?

    I'm having the same problem, I'm trying to do the POST and redirect to PayPal site at the same time but the page is shown in my server.

    Thanks in advance.

    Luciano
    • Post Points: 0
  • 12-14-2005 10:51 AM In reply to

    • didi
    • Not Ranked
    • Joined on 12-14-2005
    • New Member
    • Points 5
    you have only to activate "microsoft xml 4.0" or "microsofr XML 5.0" and clik OK
    • Post Points: 0
  • 01-25-2006 2:22 PM In reply to

    Any solutions?

    I'm also looking for a solution to this problem.  Has anyone else any answers?  My problem being if you post back a string which contains an & - then what happens?

    Thanks,

    Chris
    • Post Points: 0
Page 2 of 3 (33 items) < Previous 1 2 3 Next >