Response.Redirect在循环中?! [英] Response.Redirect in a loop?!
问题描述
你好
我有一个问题,但我希望有人有答案!
为了发送一些短信来自网站,我需要使用包含参数的查询字符串调用新的
URL。所以我把:
<%
而(某事)
Response.Redirect www.xyz.com?p1=xx,p2=yy ......等等/>
wend
%>
麻烦当然是控制权转移到xyz网站永远不会返回。
解决方案是什么?!
祝你好运
Malcolm Messiter
而< something>
''//设置初始值
Dim objXMLHTTP,tmStart,bErrorReturned,tmCurr,iTimeTaken,strURL
strURL =" http://www.xyz.com?p1 = xx,p2 = yy"
''//开始objXMLHTTP
设置objXMLHTTP = CreateObject(" MSXML2.ServerXMLHTTP")
出错时接下来
objXMLHTTP.open" POST",strURL,false
objXMLHTTP.setRequestHeader" User-Agent",
Request.Serve rVariables(" HTTP_HOST")
objXMLHTTP.send""
tmStart =现在
bErrorReturned = 0
Do
tmCurr =现在
iTimeTaken = CInt(DateDiff(" s",tmStart,tmCurr))
如果iTimeTaken> 8然后''// 8 =超时(以秒为单位)
Response.Write ="< font color ="" #ff0000"">< b>错误:查询定时
out< / b>< / font>"
objXMLHTTP.Abort
bErrorReturned = 1
退出Do
结束如果
循环objXMLHTTP.ReadyState<> 4
如果bErrorReturned<> 1然后
如果Err.Number<> 0或objXMLHTTP.Status<> 200然后
Response.Write ="< font color ="" #ff0000"">< b>错误:查询时间
out< / b>< / font>"
else
Response.Write = objXMLHTTP.ResponseText
结束如果
结束如果
设置objXMLHTTP =没有
循环
-
问候
Steven Burn
Ur IT Mate Group
www.it-mate.co.uk
保持免费!
" Malcolm Messiter" <毫安***** @ flyingviews.com>在留言中写道
新闻:sK ******************** @ pipex.net ...你好
我有一个问题,希望有人有答案!
为了从网站发送几个短信,我需要调用一个新的>带有包含参数的查询字符串的URL。所以我把:
<%
而(某事)
Response.Redirect www.xyz.com?p1=xx,p2=yy ......等
wend
%>
解决方案是什么?!
祝福/>
Malcolm Messiter
> Response.Write ="< font color =""#ff0000"">< b>错误:
Response.Write ="< font color ="" #ff0000"">< b>错误:
Response.Write = objXMLHTTP.ResponseText
当然,这些都是应该删除=(.write是一个方法,而不是
属性)。
呵呵知道我忘了删除一些东西(我最初把它写成
函数,因此=)
为搞砸而道歉:o \
-
问候
Steven Burn
Ur IT Mate Group
www.it-mate.co.uk
免费保留!
" Aaron Bertrand [SQL Server MVP]" < TE ***** @ dnartreb.noraa>在消息中写道
news:u3 ************** @ TK2MSFTNGP14.phx.gbl ...Response.Write ="< font color ="" #ff0000"">< b>错误:
Response.Write ="< font color ="" #ff0000"">< b>错误:
Response.Write = objXMLHTTP.ResponseText
当然,这些都应该删除=(.write是一种方法,而不是
属性)。
Hello
I have a question to while I hope someone has the answer!
In order to send several SMS texts from a web site, I need to invoke a new
URL with a query string containing the parametres. So I put:
<%
while (something)
Response.Redirect www.xyz.com?p1=xx,p2=yy... etc.
wend
%>
Trouble is of course, control goes off to the xyz site never to return.
What''s the solution?!
Best wishes
Malcolm Messiter
While <something>
''// Setup Init
Dim objXMLHTTP, tmStart, bErrorReturned, tmCurr, iTimeTaken, strURL
strURL = "http://www.xyz.com?p1=xx,p2=yy"
''// Begin objXMLHTTP
set objXMLHTTP = CreateObject("MSXML2.ServerXMLHTTP")
on error resume next
objXMLHTTP.open "POST", strURL, false
objXMLHTTP.setRequestHeader "User-Agent",
Request.ServerVariables("HTTP_HOST")
objXMLHTTP.send ""
tmStart = Now
bErrorReturned = 0
Do
tmCurr = Now
iTimeTaken = CInt(DateDiff("s", tmStart, tmCurr))
If iTimeTaken > 8 Then ''// 8 = timeout (in seconds)
Response.Write = "<font color=""#ff0000""><b>Error: Query timed
out</b></font>"
objXMLHTTP.Abort
bErrorReturned = 1
Exit Do
End If
Loop While objXMLHTTP.ReadyState <> 4
If bErrorReturned <> 1 Then
if Err.Number <> 0 or objXMLHTTP.Status <> 200 then
Response.Write = "<font color=""#ff0000""><b>Error: Query timed
out</b></font>"
else
Response.Write = objXMLHTTP.ResponseText
end if
end if
set objXMLHTTP = nothing
Loop
--
Regards
Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk
Keeping it FREE!
"Malcolm Messiter" <ma*****@flyingviews.com> wrote in message
news:sK********************@pipex.net...Hello
I have a question to while I hope someone has the answer!
In order to send several SMS texts from a web site, I need to invoke a new
URL with a query string containing the parametres. So I put:
<%
while (something)
Response.Redirect www.xyz.com?p1=xx,p2=yy... etc.
wend
%>
Trouble is of course, control goes off to the xyz site never to return.
What''s the solution?!
Best wishes
Malcolm Messiter
> Response.Write = "<font color=""#ff0000""><b>Error:
Response.Write = "<font color=""#ff0000""><b>Error: Response.Write = objXMLHTTP.ResponseText
Of course, these all should have the = removed (.write is a method, not a
property).
hehe knew I''d forget to remove something (I originally wrote it as a
function, hence the =)
Apologies for the screwup :o\
--
Regards
Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk
Keeping it FREE!
"Aaron Bertrand [SQL Server MVP]" <te*****@dnartreb.noraa> wrote in message
news:u3**************@TK2MSFTNGP14.phx.gbl...Response.Write = "<font color=""#ff0000""><b>Error:
Response.Write = "<font color=""#ff0000""><b>Error:
Response.Write = objXMLHTTP.ResponseText
Of course, these all should have the = removed (.write is a method, not a
property).
这篇关于Response.Redirect在循环中?!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!