Go Back   SitePoint Forums > Forum Index > Program Your Site > Classic ASP
Newsletter FAQ Members List Calendar Mark Forums Read

New to SitePoint Forums? Register here for free!

SitePoint Sponsor
 
Reply
 
Thread Tools Display Modes
Old Mar 15, 2004, 09:43   #1
amitabh
SitePoint Enthusiast
 
Join Date: Jun 2003
Location: India
Posts: 80
How to POST to another page

Hi

Is there a way I can POST data from a ASP page to another page? I am not trying to POST data from a form to another page, but would like to create the POST headers from different variables, and then send it to another page.

Hope I am clear in my question.

Amitabh
amitabh is offline   Reply With Quote
Old Mar 15, 2004, 09:49   #2
bbolte
Do or do not, there is no try
 
bbolte's Avatar
 
Join Date: Nov 2001
Location: The Central Plains
Posts: 3,244
you can send them through the url string or place them in a cookie.
bbolte is offline   Reply With Quote
Old Mar 15, 2004, 09:56   #3
amitabh
SitePoint Enthusiast
 
Join Date: Jun 2003
Location: India
Posts: 80
I can't append them in a query string, and I can't use cookies too. I need it to POST data to a different server.
amitabh is offline   Reply With Quote
Old Mar 15, 2004, 10:57   #4
bbolte
Do or do not, there is no try
 
bbolte's Avatar
 
Join Date: Nov 2001
Location: The Central Plains
Posts: 3,244
oops. totally misread that. hmmmm. you'll have to forgive me but i need a little more info. how is the other server getting or using the data?

could xml work here? i've used the xml and http objects to move data between servers.
bbolte is offline   Reply With Quote
Old Mar 15, 2004, 15:11   #5
asp_funda
SitePoint Wizard
silver trophybronze trophy
 
asp_funda's Avatar
 
Join Date: Jun 2003
Location: Andromeda Galaxy
Posts: 4,487
You can use the querystrings, there's no problem in that, & it works across different servers. But it has limitations & you can't pass on large amount of data, just a few small variables.

Another way is to send it using SOAP.
__________________
Our lives teach us who we are.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Me - My Photo Blog - My Hindi Blog - My Blog
iG:Syntax Hiliter -- Colourise your WordPress code!!
asp_funda is offline   Reply With Quote
Old Mar 15, 2004, 15:42   #6
kgh
SitePoint Guru
 
Join Date: Sep 2003
Location: San Diego, CA
Posts: 590
Is it from a link? Cause couldn't you have a hidden form with all hidden variables, and submit it with the link? The link would be something like javascript:document.form_name.submit(); Would this work?
kgh is offline   Reply With Quote
Old Mar 15, 2004, 16:13   #7
HuevosRancheros
SitePoint Member
 
HuevosRancheros's Avatar
 
Join Date: Mar 2004
Location: Santa Monica, CA
Posts: 19
There's a com object that I use quite a bit called URLFetch which supports direct posts (even via HTTPS). I've used it to make some simple spiders that post to a form and then parse the response.

Check it out at: http://www.screen-scraper.com/urlfetch/doc.shtml

--HH


Quote:
Originally Posted by amitabh
Hi

Is there a way I can POST data from a ASP page to another page? I am not trying to POST data from a form to another page, but would like to create the POST headers from different variables, and then send it to another page.

Hope I am clear in my question.

Amitabh
HuevosRancheros is offline   Reply With Quote
Old Mar 15, 2004, 18:04   #8
fillup07
Phil
 
fillup07's Avatar
 
Join Date: May 2002
Location: Jacksonville, FL
Posts: 1,171
Yes.
Right here is a really good start:
http://www.sitepoint.com/forums/showthread.php?t=49339
__________________
Jacksonville website design
fillup07 is offline   Reply With Quote
Old Mar 15, 2004, 21:14   #9
amitabh
SitePoint Enthusiast
 
Join Date: Jun 2003
Location: India
Posts: 80
Sorry for the late reply, but the remote server only accepts POST method. It will return some data based on the values that I post. XML is an option that I have, but since I ahve no idea of an XML, I was thinking the other way.
amitabh is offline   Reply With Quote
Old Mar 16, 2004, 02:30   #10
MarcusJT
The doctor is in...
silver trophy
 
MarcusJT's Avatar
 
Join Date: Jan 2002
Location: London
Posts: 3,536
You actually don't need to know/understand/use XML to use the XMLHTTP component - it's just a standard HTTP component that has a few XML-friendly features. Read up in the link that fillup07 posted, and in the XML reference documentation. Make sure you use Microsoft.ServerXMLHTTP, not the (client-side) Microsoft.XMLHTTP.

Alternatively, cut out the middleman and use WinHTTP.
__________________
MarcusJT
- former ASP web developer / former SPF "ASP Guru"
- *very* old blog with some useful ASP code

- Please think, Google, and search these forums before posting!
MarcusJT is offline   Reply With Quote
Old Mar 16, 2004, 09:59   #11
asp_funda
SitePoint Wizard
silver trophybronze trophy
 
asp_funda's Avatar
 
Join Date: Jun 2003
Location: Andromeda Galaxy
Posts: 4,487
Quote:
Originally Posted by HuevosRancheros
There's a com object that I use quite a bit called URLFetch which supports direct posts (even via HTTPS).
I don't think that his webhost will allow him to register the COM on the server, unless ofcourse if you are using ASP.NET.
__________________
Our lives teach us who we are.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Me - My Photo Blog - My Hindi Blog - My Blog
iG:Syntax Hiliter -- Colourise your WordPress code!!
asp_funda is offline   Reply With Quote
Old Mar 16, 2004, 10:39   #12
ole dawg
SitePoint Addict
 
Join Date: Sep 2003
Location: Kingston
Posts: 245
I've done this before very simply by having an asp page which retrieves data from a database and populates a form whose ACTION is a page on another server. The page then auto-submits by using a bit of javascript (onload=document.form.submit).

It' s been used every day for about 2 years and has worked perfectly every time.
ole dawg is offline   Reply With Quote
Old Mar 16, 2004, 11:47   #13
asp_funda
SitePoint Wizard
silver trophybronze trophy
 
asp_funda's Avatar
 
Join Date: Jun 2003
Location: Andromeda Galaxy
Posts: 4,487
Yeah but the problem with this is, if the user has JavaScript disabled, nothing will be done.

Its better to do this kinda stuff on the predictable server, rather than relying on un-predictable client.
__________________
Our lives teach us who we are.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Me - My Photo Blog - My Hindi Blog - My Blog
iG:Syntax Hiliter -- Colourise your WordPress code!!
asp_funda is offline   Reply With Quote
Old Mar 16, 2004, 17:14   #14
af11kcc
SitePoint Zealot
 
af11kcc's Avatar
 
Join Date: Oct 2003
Location: South of Rio Grande
Posts: 124
Maybe this one:

http://www.serverobjects.com/products.htm#asphttp
af11kcc is offline   Reply With Quote
Old Mar 16, 2004, 17:35   #15
MarcusJT
The doctor is in...
silver trophy
 
MarcusJT's Avatar
 
Join Date: Jan 2002
Location: London
Posts: 3,536
Has anyone actually read my post?
Quote:
Originally Posted by M@rco
You actually don't need to know/understand/use XML to use the XMLHTTP component - it's just a standard HTTP component that has a few XML-friendly features. Read up in the link that fillup07 posted, and in the XML reference documentation. Make sure you use Microsoft.ServerXMLHTTP, not the (client-side) Microsoft.XMLHTTP.

Alternatively, cut out the middleman and use WinHTTP.
__________________
MarcusJT
- former ASP web developer / former SPF "ASP Guru"
- *very* old blog with some useful ASP code

- Please think, Google, and search these forums before posting!
MarcusJT is offline   Reply With Quote
Old Mar 16, 2004, 17:37   #16
fillup07
Phil
 
fillup07's Avatar
 
Join Date: May 2002
Location: Jacksonville, FL
Posts: 1,171
Now why would he want a good solution that doesn't require a component by a 3rd party? ...
__________________
Jacksonville website design
fillup07 is offline   Reply With Quote
Old Mar 17, 2004, 09:53   #17
amitabh
SitePoint Enthusiast
 
Join Date: Jun 2003
Location: India
Posts: 80
Thanks everybody. I am testing the option sugegsted by M@cro. Hopefully, I should be able to accomplish my goals.
amitabh is offline   Reply With Quote
Old Mar 17, 2004, 10:37   #18
asp_funda
SitePoint Wizard
silver trophybronze trophy
 
asp_funda's Avatar
 
Join Date: Jun 2003
Location: Andromeda Galaxy
Posts: 4,487
Quote:
Originally Posted by M@rco
Has anyone actually read my post?
Yeah, I've read your post, but it seems like neither amitabh has read it nor other people.
__________________
Our lives teach us who we are.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Me - My Photo Blog - My Hindi Blog - My Blog
iG:Syntax Hiliter -- Colourise your WordPress code!!
asp_funda is offline   Reply With Quote
Old Mar 18, 2004, 13:03   #19
cmorbutts
SitePoint Zealot
 
cmorbutts's Avatar
 
Join Date: Apr 2002
Location: Sydney, Australia
Posts: 173
Like M@rco suggested, WinHTTP is your best bet. It comes pre-installed with Win2k Service Pack 3 or Win2k3 Server so if your server is anything less you may not be able to use it. I think you can download the component from Microsoft standalone and install it anyway but I can't remember.

Alternatively, there's another thing you can use. I have some code stashed away somewhere and it's using the Inet ctl something or other. Let me know if you want it.
__________________
www.jasonwong.net
cmorbutts is offline   Reply With Quote
Old Mar 18, 2004, 17:16   #20
amitabh
SitePoint Enthusiast
 
Join Date: Jun 2003
Location: India
Posts: 80
Quote:
Originally Posted by asp_funda
Yeah, I've read your post, but it seems like neither amitabh has read it nor other people.
I have definitely read M@rco replies, and that's what I am trrying out right now.
amitabh is offline   Reply With Quote
Old Mar 19, 2004, 10:40   #21
asp_funda
SitePoint Wizard
silver trophybronze trophy
 
asp_funda's Avatar
 
Join Date: Jun 2003
Location: Andromeda Galaxy
Posts: 4,487
good. just thought that you could post the feedback if you get it right, not that its necessary.
__________________
Our lives teach us who we are.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Me - My Photo Blog - My Hindi Blog - My Blog
iG:Syntax Hiliter -- Colourise your WordPress code!!
asp_funda is offline   Reply With Quote
Old Mar 22, 2004, 10:55   #22
amitabh
SitePoint Enthusiast
 
Join Date: Jun 2003
Location: India
Posts: 80
Thanks M@rco. I was trying to get some financial data from a brokers site, and it really did help.
amitabh is offline   Reply With Quote
Old Aug 11, 2006, 14:24   #23
b2k4@email.com
SitePoint Member
 
Join Date: Aug 2006
Posts: 1
problem with WINHTTP Can someone help?

Quote:
Originally Posted by cmorbutts
Like M@rco suggested, WinHTTP is your best bet. It comes pre-installed with Win2k Service Pack 3 or Win2k3 Server so if your server is anything less you may not be able to use it. I think you can download the component from Microsoft standalone and install it anyway but I can't remember.

Alternatively, there's another thing you can use. I have some code stashed away somewhere and it's using the Inet ctl something or other. Let me know if you want it.
I am trying to send the data from my form to a file which interacts with the database and then displays the message.I am trying to use WINHTTP function post to send the data and get this displayed.
However when I post and try to get the values of the form using request variables I am unable to get the value.Can you please suggest accordingly?
b2k4@email.com is offline   Reply With Quote
Old Aug 14, 2006, 11:18   #24
MarcusJT
The doctor is in...
silver trophy
 
MarcusJT's Avatar
 
Join Date: Jan 2002
Location: London
Posts: 3,536
Quote:
Originally Posted by b2k4@email.com
I am trying to send the data from my form to a file which interacts with the database and then displays the message.I am trying to use WINHTTP function post to send the data and get this displayed.
However when I post and try to get the values of the form using request variables I am unable to get the value.Can you please suggest accordingly?
Don't forget that as well as specifying the HTTP POST method in the call to .Open() you need to provide the actual data (suitably encoded according to the ContentType that you're using - e.g. "multipart/form-data" or "application/x-www-form-urlencoded") as a parameter to the call to .Send()

PS - Hello everyone! Thought I'd drop in and say hello... it's been a while... what have I missed?!
__________________
MarcusJT
- former ASP web developer / former SPF "ASP Guru"
- *very* old blog with some useful ASP code

- Please think, Google, and search these forums before posting!
MarcusJT is offline   Reply With Quote
Old Aug 14, 2006, 14:43   #25
wulf
Non-Member
 
wulf's Avatar
 
Join Date: Jul 2006
Posts: 217
I dont know if this will work but in flash if you use the "get" method from an ASP page on the asp page you have to type response.write("variable=content+morecontent")
You pretty much write it out like a real post statement. + = space between words....
you can also use &secondvariable=content&thirdvariable=content
and so on...
wulf is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread | Next Thread »

Thread Tools
Display Modes

 
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 -7. The time now is 09:23.


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright 1998-2009, SitePoint Pty Ltd. All Rights Reserved