在Response.Redirect(经典asp)中使用包含URL的变量 [英] using a variable containing a URL in Response.Redirect (classic asp)

查看:346
本文介绍了在Response.Redirect(经典asp)中使用包含URL的变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些经典的ASP代码,可调用Web服务. Web服务将返回一个URL,我需要在"Response.Redirect()"中使用该URL,请参见下面的代码片段:

I have some classic asp code that calls a web service. The web service rreturns a url which i need to use in "Response.Redirect() see snippet of code below:

DataToSend="acctNum="&Request.Form("txtacctNum")&"&MRN="&Request.Form("txtMRN")
    Dim postUrl
    postUrl = "http://localhost/edChartLink2/edChartLink2/edChartLink.asmx/GetToken"
    Set xmlhttp = server.Createobject("MSXML2.XMLHTTP")
    xmlhttp.Open "POST",postUrl,false
    xmlhttp.setRequestHeader "Content-Type:", "application/x-www-form-urlencoded"
    xmlhttp.send DataToSend & "<br>"
    Response.Write(xmlhttp.responseText)
    Response.write("<br>")
    chartUrl = xmlhttp.responseText
    
    //chartUrl = Server.URLEncode(xmlhttp.responseText)
    Response.write(chartUrl)
 
  
    Response.Redirect(chartUrl)</br></br>



无论我做什么,我都会收到404错误代码,无法找到该页面.我也尝试过Server.Transfer.无法使其正常工作.

我需要将用户发送到新页面.

有人可以帮忙吗?

谢谢



No matter what I do, I get a 404 error code can''t find the page. I have also tried Server.Transfer. Unable to get that to work.

I need send the users to the new page.

Can anybody please help.

Thanks

推荐答案

如果您收到404,您是否已验证服务返回给您的URL是否有效?那将是第一步.只需将URL写入屏幕,然后将其复制并粘贴到新的浏览器中即可验证它是否正确. (以防万一您没有注意到,您也注释掉了设置chartUrl变量的行).
If you are getting a 404, have you verified that the URL the service is returning to you even works? That would be the first step. Just write the URL to the screen and then copy and paste it into a new browser to validate that it is actually correct. (Just in case you haven''t noticed, you have commented out the line that sets your chartUrl variable as well).


这篇关于在Response.Redirect(经典asp)中使用包含URL的变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆