Click here to Skip to main content
15,881,938 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
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>


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
Posted
Updated 24-Feb-11 13:02pm
v2

1 solution

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).
 
Share this answer
 
Comments
Espen Harlinn 25-Feb-11 6:26am    
Good advice - my 5
Jose Garcia 25-Feb-11 7:34am    
Yes I did write it to the screen and copy and pasted the url to a broswser and it worked ok. I tried all kinds of combinations and now I'm getting a 400 error which is I'm hitting the server but it can't display the page. I'm truly at a lost here puzzled. ! I'm open to any other ideas. Oh charturl I had commented out because that was just one of this things I was testing to see if I could get it to work. THis can't be that difficult ??

Any help is truly and greatly appreciated. I'm under a severe time constraint to get this done.
Jose Garcia 25-Feb-11 8:06am    
Hi I believe I know what is happening. When I do a response.write(chartUrl) to the screen I get the followin url:

http://emhaallrca/HMALED_EMH/edchartlink.aspx?token=KVUnPujENznXJMKbC4ZiTGDPu7HP%2bs41lQGR5tZWsiyZRfKNP2jBVsLYSGg%3d&chart=KJOBwFtBtQRmtObtKxLXMzQ+uXOny+R7C69WrIjRtWfCQLWuyUiG4ISTqSMizwlr/EGb61ws78ijm2R+

Which is what I want.
When is user Response.Redirect chartUrl I get:

http://domestic/edChartLink2/edChartLink2/%3C?xml%20version="1.0"%20encoding="utf-8"?>%0D%0A<string%20xmlns="http: emhrhs.org="" "="">http://emhaallrca/HMALED_EMH/edchartlink.aspx?token=ythwDaATBzYusrBZQwsRAvyVl2F%2fei%2bJTWqcBmlyCrpvy4yFUNzps%2bhHmIU%3d&chart=dacQlNsNIlhaclNQAnewoD/Mz6mAG1kJLkdZCnX5bvYdUYTQK+AnxH1Ofn+zyzNXMnPBxwWDK1mGugCQ

It looks like it is adding header information ? So How can I strip this off.

Thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900