PDA

View Full Version : posting data with response.redirect


sweenster
02-28-2005, 03:48 PM
If i use the ASP command response.redirect to divert to another page is there any way I can "post" information to the redirected page?

I know i could use the query string to pass the information as GET - i.e. response.redirect("page.asp?date=1&data=2") - but would prefer to use POST if possible

glenngv
03-01-2005, 04:32 AM
Use Server.Transfer (http://www.w3schools.com/asp/met_transfer.asp)

BTW, this should be moved to ASP Forum.

sweenster
03-01-2005, 11:30 AM
server.transfer works fine for a local file, but what if the file is on another server? can it accept http:// pages?

glenngv
03-01-2005, 11:59 AM
Unfortunately not. If you want to redirect via POST to an external site, your only choice is to submit the form (with hidden fields) onload using javascript.

<%
'codes here...
%>
<html>
<head>
<title>Please wait...</title>
</head>
<body onload="document.form1.submit()">
Please wait...
<form name="form1" action="http://www.othersite.com/" method="post">
<input type="hidden" name="field1" value="<%=field1%>" />
<input type="hidden" name="field2" value="<%=field2%>" />
...
</form>
</body>
</html>

ghell
03-01-2005, 03:53 PM
some servers dont even do that, you can always try xmlhttp though, or a similar thing in a COM component

(look in xml section on w3schools for xmlhttp)

miranda
03-02-2005, 08:04 AM
I know response.Redirect will accept parameter(s) passed in it on the same server I don't see why it wouldn't work when it is redirecting to a different server.

Response.Redirect "mypage.asp?a=" & someVar & "&b=" & someOtherVariable

glenngv
03-02-2005, 09:56 AM
I know response.Redirect will accept parameter(s) passed in it on the same server I don't see why it wouldn't work when it is redirecting to a different server.

Response.Redirect "mypage.asp?a=" & someVar & "&b=" & someOtherVariable
sweenster wants it POST not GET.