Go Back   CodingForums.com > :: Server side development > ASP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-02-2006, 01:03 PM   PM User | #1
ShMiL
Regular Coder

 
Join Date: Jul 2002
Posts: 436
Thanks: 1
Thanked 0 Times in 0 Posts
ShMiL is an unknown quantity at this point
posting using server side script

I want to post (like form: method=post) through the server.
response.redirect doesn't pass parameters (and I don't want to put them on the URL).
Server.Transfer only works in the same server, and I want to post to a page on another server.

Any idea?

Thanks
ShMiL is offline   Reply With Quote
Old 04-03-2006, 02:17 PM   PM User | #2
degsy
Senior Coder

 
Join Date: Nov 2002
Location: North-East, UK
Posts: 1,265
Thanks: 0
Thanked 0 Times in 0 Posts
degsy is on a distinguished road
You could use XMLhttp
http://www.4guysfromrolla.com/webtech/110100-1.2.shtml

Code:
<%@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
Code:
<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
%>
degsy is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:06 PM.


Advertisement
Log in to turn off these ads.