日期:2014-05-17  浏览次数:20924 次

ASP如何构造和发送一个http请求到一个固定页面?
因为对方接受参数的页面不可控制,而对方的页面是request的方法来取参数的,
不能使用XML格式传送数据

我希望的是能够在asp页面发送一个http请求到目的页面,而不访问它。

(url传参,post,session,java脚本等,传参都不是我我想要的回答,前提是我不访问对方的页面,而且是不能使用java脚本的WAP页面)

------解决方案--------------------
AJAX:
<script language= "JavaScript " >
if (window.XMLHttpRequest)
{ // Mozilla, Safari, ...
http_request = new XMLHttpRequest();
}
else if (window.ActiveXObject)
{ // IE
http_request = new ActiveXObject( "Microsoft.XMLHTTP ");
}
var linkurl= "ajax_server.asp?classid=aa "
//alert(linkurl);
http_request.open( "GET ",linkurl,false);
http_request.onreadystatechange =function(){UpdateMenu(http_request,classid)};
http_request.send(null);
</script >
------解决方案--------------------
不明白你的意思,如果你只是传参数,img标签就可以实现了

<img src= "http://www.com/111.asp?a=b " alt= " " />

在对方的111.asp里用Request( "a ")就可以获得参数

如果对方是用Request.Form获取参数就用XMLHttpRequest对象,这个对象并不是只能在客户端用的,不要被AJAX这个概念蒙蔽了,它只是XMLHttpRequest的派生产品

Dim argv
argv = "参数名= " & Server.URLEncode( "参数值 ") & "&参数名= " & Server.URLEncode( "参数值 ")
Dim xmlHttp
Set xmlHttp = Server.CreateObject( "MSXML2.ServerXMLHTTP ")
xmlHttp.setTimeouts 10000, 10000, 30000, 30000
xmlHttp.open "POST ", "目标页面 ", False
xmlHttp.setRequestHeader "Content-Type ", "application/x-www-form-urlenocded "
xmlHttp.setRequestHeader "Content-Length ", Len(argv)
xmlHttp.send argv
Set xmlHttp = Nothing