Sharing: XMLHTTP GETPOST method and the corresponding BrowserServer end

xiaoxiao2021-03-06  38

[Browser Side] With the XMLHTTP control, you can request a page to the Server in GET or POST. "Implement Script Callback Framework In ASP.NET 1.x", elvin Cheng is the JavaScript code written to the Client Side: IF (Pageurl.Length PostData.length 1> 2067) {XmlRequest.Open ("POST", PageURL, FALSE); XMLRequest.senaquestHeader ("Content-Type", "Application / X-WWW-Form-Urlencoded"); XMLRequest.send (POSTDATA);} else {ix ("?")! = -1) XmlRequest.open ("GET", PageURL "&" POSTDATA, FALSE); Else XmlRequest.open ("get", PageURL " PostData, False); XmlRequest.seueStheader (" Content-Type "," Application / X-WWW-FORM-URLENCODED "); XmlRequest.send ();} [server side] 1. In the GET method, information can only be passed through Query String, and the Server end is simple, from the request. All Key and Value can be obtained in queryString. Second, with POST, it is slightly more complicated. 2 A, if the post is a string (for example, when Query String is too long), it is very simple, requEST.FORM is similar to the request.queryString in the GET mode; two B, if POST is an XML object, then you need: 'CHECK that something has been posted If Request.ServerVariables ( "REQUEST_METHOD") = "POST" Then 'Check that an XMLHTTP object has been posted If Request.ServerVariables ( "CONTENT_TYPE") <> "application / x-www-form-urlencoded" Then 'initialise an XML DOM object Set oXMLDOM = Server.CreateObject ( "MSXML2.DOMDocument") oXMLDOM.resolveExternals = False oXMLDOM.validateOnParse = False oXMLDOM.async = False' load the request data into XML DOM Call oXMLDOM.load (Request) 'Do Something with XML Dom Here' ************************** * End if End IF

转载请注明原文地址:https://www.9cbs.com/read-57821.html

New Post(0)