I found that we can use xmlHTTP.
Submit the form to a script on your server then create a xmlHTTP post to post the datato the form. You will receive a response that you can then output to the user.
form.asp
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
If Len(Request.Form) > 0 Then
dim strResponse,destURL,strContent
destURL = "http://domain.com/script.asp"
Response.Write destURL
'Construct the Post Data
strContent = strContent & "name=" & server.URLencode(Request.Form("name"))
strContent = strContent & "&pass=" & server.URLencode(Request.Form("pass"))
'Construct the useragent and send
set http_obj=server.CreateObject("MSXML2.ServerXMLHTTP ")
http_obj.Open "POST", destURL , false
http_obj.setRequestHeader "Content-type", "application/x-www-form-urlencoded"
http_obj.send(strContent)
'Grab the response
strResponse = http_obj.ResponseText
set http_obj=nothing
Response.Write "Form sent"
response.write( strResponse )
End If
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<form name="form1" method="post" action="">
<p>Name:
<input name="name" type="text" value="joe">
</p>
<p>Pass:
<input name="pass" type="password" value="1234">
</p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
</form>
</body>
</html>
script.asp
<H1>Thankyou for posting data</H1>
<p>Here are the results</p>
<%
For Each Item In Request.Form
Response.Write Item & ": " & Request.Form(Item) & "<br>"
Next
%>
The HTML output of this page will be the strResponse variable.
-------------------------------------
HOWEVER, i'd like to submit the form at ASP server side, the go to the destination page that received the form... Any hints? thanks
|