XmlHttp参数传递的问题

hj3793 hj3793 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区

function GetResult(str,cmd,plMan,plMemo,nbID)
{
var DataToSend = str+"@#@"+cmd+"@#@"+plMan+"@#@"+plMemo+"@#@"+nbID;
var http = new ActiveXObject("Microsoft.XMLHTTP");
http.open("POST","../NewsService/News.aspx",false);
http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
http.send(DataToSend);
result = http.responseText;
return result;
}
--------------------------------
当传递的参数中有 HTML 标签的时候就报错

<title>从客户端(="...dd@#@d@#@a<br>a,nbsp;,nbsp; ...")中检测到有潜在危险的 Request.Form 值。</title>

有什么办法解决吗??
...全文

相关推荐

xmlhttp.chm

xmlhttp.chm参考手册

love86

XMLHttp中文参考手册

XMLHttp中文参考手册,对Xmlhttp对象的的属性和方法进行说明,便于开发。Write Less;Do More.

如山似水0_0

在VC中使用XMLHTTP

主  题: 在VC中使用XMLHTTP,怎样初始化,怎样建立连接?在线等。 我的一段代码在.NET中用C#已经调通,我想搬到VC++ 6.0上,但不知道任何各种写法规则。 C# 中为: MSXML2.XMLHTTP xmlHttp_ = new XMLHTTP(); xmlHttp_.open("PROPFIND", serverUrl, false, username, password); xmlHttp_.send(null); 放到VC++ 6.0 中应为什么? 以下是我写的,但运行出错。 #import "msxml4.dll" using namespace MSXML2; HRESULT hr; //MSXML2::IXMLHTTPRequest pIXMLHttpRequest; CString serverUrl ="http://services.msn.com/svcs/hotmail/httpmail.asp"; MSXML2::IXMLHTTPRequestPtr pIXMLHttpRequest; pIXMLHttpRequest.CreateInstance("Msxml2.XMLHTTP.4.0"); if (pIXMLHttpRequest==NULL) AfxMessageBox("pIXMLHttpRequest error"); try { // Create XMLHttpRequest object and initialize pIXMLHttpRequest. hr = pIXMLHttpRequest->open(_bstr_t(_T("PROPFIND")), _bstr_t(_T(serverUrl)), _variant_t(VARIANT_FALSE), _variant_t("test5_12"), _variant_t("1234567")); if(SUCCEEDED(hr)) ::MessageBox(NULL, _T("Success !"), _T(""), MB_OK); } catch(...) { //DisplayErrorToUser(); AfxMessageBox("error"); } 在调用方法open的时候出错! 回复人: masterz(www.fruitfruit.com) ( ) 信誉:273 2003-06-10 21:34:02Z 得分:20 ? #import "msxml.dll" #import "msxml2.dll" using namespace MSXML2; int main(int argc, char* argv[]) { printf("Test of XMLHTTP by masterz!\n"); CoInitialize(NULL); try { IXMLHTTPRequestPtr xmlrequest; xmlrequest.CreateInstance("Msxml2.XMLHTTP"); _variant_t varp(false); xmlrequest->open(_bstr_t("GET"),_bstr_t("http://www.csdn.net/expert/topic/855/855052.xml?temp=.176037"),varp); xmlrequest->send(); BSTR bstrbody; xmlrequest->get_responseText(&bstrbody); _bstr_t bstrtbody(bstrbody); printf("%s\n",(LPCTSTR)bstrtbody); } catch (_com_error &e) { printf("Description = '%s'\n", (char*) e.Description()); } CoUninitialize(); printf("program end\n"); return 0; } ///////Post with XMLHTTP/////////////////////// #import "msxml.dll" #import "msxml2.dll" #include "Atlbase.h" using namespace MSXML2; int main(int argc, char* argv[]) { printf("Test of XMLHTTP by masterz!\n"); CoInitialize(NULL); try { IXMLHTTPRequestPtr xmlrequest; //xmlrequest.CreateInstance("Msxml2.XMLHTTP"); xmlrequest.CreateInstance(__uuidof(XMLHTTP)); CComVariant vFalse(FALSE); CComVariant vNull(NULL); xmlrequest->open("POST", _bstr_t("http://211.157.102.21/member/logon.asp"),vFalse,vNull,vNull); xmlrequest->setRequestHeader("Content-Type:","application/x-www-form-urlencoded"); _bstr_t bsdata("name=xxx&pass=xxx&type=1");//use your login name and password xmlrequest->send(_variant_t(bsdata)); BSTR bstrbody; xmlrequest->get_responseText(&bstrbody); _bstr_t bstrtbody(bstrbody); printf("%s\n",(LPCTSTR)bstrtbody); //MessageBox(0,bstrtbody,"",MB_OK); } catch (_com_error &e) { printf("Description = '%s'\n", (char*) e.Description()); } CoUninitialize(); printf("program end\n"); return 0; }

cool_s

ajax回调函数参数传递正确方法

属性方法是可以带参数: 代码如下: function ClassX(name) { this.name = name; ClassX.prototype.show = function (param) { alert&#40;this.name + ” ” + param&#41;; }; } var o = new ClassX(“name”); o.show(“param”);//name param 但是,上面是虽然是直接在函数签名中定义了参考,如果不是自己调用o.show(‘param’)时,而是通过其他函数回调传入时,就不一定好使了,因为别人在调用此方法时不一定给你传入此参,比如在使用ajax时

weixin_38649356

四步轻松实现ajax发送异步请求

主要教大家轻松实现ajax发送异步请求,具有一定的参考价值,感兴趣的小伙伴们可以参考一下

weixin_38600253
评论 3
收藏 已收藏
分享
返回顶部
hj3793
.NET社区 62,272 成员 668,968 内容