How To Submit Form Data by Using XMLHTTP or ServerXMLHTTP Object
Article ID | : | 290591 |
Last Review | : | July 13, 2004 |
Revision | : | 1.0 |
This article was previously published under Q290591
On this page
![]() | SUMMARY | |
![]() | MORE INFORMATION | |
![]() | REFERENCES |
SUMMARY
In some cases, you may want to send data to a port or server so that you can use the
Form collection on the
Request object in the page or listening application. To do this, you need to add headers to notify the receiver that the body contains data that can be accessed from the
Form collection.
MORE INFORMATION
Requests that are being sent are based on two parts: the
Header and the
Body. The
Header contains information about the
Body so that the receiver knows what data is contained there.
When you use just the
XMLHTTP object from client-side script, the same header information and data format must be observed.
Header Information
The Header information that needs to be set is the Content-Type. In this case, set this to the value of application/x-www-form-urlencoded.Body Data
The Body contains the data that you want to send. The data takes the shape of name= value. For multiple values, you can use the "&" symbol to separate each name-value pair. For example:
input1=Hello&input2=World&idValue=12345
The receiver is able to pick the values "Hello," "World," and "12345" by using the names "input1," "input2," and "idValue" respectively.
Step-by-Step Instruction for ServerXMLHTTP Object
1. | Ensure that the server has MSXML 3.0 or later parser, that the Proxy Configuration Utility has been run, and that the settings have been configured. For more information, see the "References" section of this article. |
2. | Copy the following code into a new Active Server Pages (ASP) page called ServerHTTP.asp. Place the ASP page in the default Home directory. NOTE: The two ASPs should be in different virtual folders due to threading issues.If pooling is set to Low or Medium (this is the default for Microsoft Windows 2000), you should POST to an ASP in a different virtual folder. If the ASP is in the same virtual folder, the ASP stops responding (hangs). After you close the browser, that ASP and other ASPs continue to hang because the request stays queued even though you close the browser. You must restart IIS or restart the computer. If you change the pooling to High, you can run the code to the remote ASP again because you are using a new thread. |
3. | Copy the following code into a new ASP page called Receiver.asp. Place the ASP page in the default Home directory. When Posting, be sure that you use the name of the server, not Localhost, and that the URL that is being opened by the XMLHttp, should also contain the same server name. |
4. | Ensure that the "POST" is pointing to the correct location. |
5. | Click the Submit XMLHTTP button. |
Step-by-Step Instruction for XMLHTTP Object
1. | Copy the following code into a new ASP page called ClientHTTP.asp. Place the ASP page in the default Home directory.
|
2. | Create the page from step 3 of the ServerXMLHTTP steps outlined previously. |
3. | Ensure that the "POST" is pointing to the correct location. |
4. | Load the ClientHTTP.asp in a browser |
REFERENCES
For additional information, click the article number below to view the article in the Microsoft Knowledge Base:
289481 How To Proxy Configuration Utility Must Be Run for ServerXMLHTTP to Work
APPLIES TO
• | Microsoft XML Parser 3.0 Service Pack 3 |
• | Microsoft XML Parser 3.0 Service Pack 1 |
• | Microsoft XML 4.0 |
Keywords: | kbhowto KB290591 |