Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Programmatic POST Operation

6 views
Skip to first unread message

David P. Donahue

unread,
Jan 17, 2003, 12:19:09 PM1/17/03
to
Ok, this may sound strange, but I have my reasons....

I want to have a form on my page that simply posts to another page on my
website (no problem there). Then that other page would have some basic
output to the user and a bunch of code-behind that handles the POST data
(still no problem). That code-behind would gather all the POSTed fields,
add some more fields, and then do its own POST to another URL (aye, there's
the rub). Any idea how to do that last part? Basically, I want to have
some fields that are completely unseen to the client. I don't mind sending
them over the Internet in general, but I'd sleep better at night if they're
not sent to the client's browser as simple type="hidden" fields.


David P. Donahue
david....@firstsolution.com


Kevin Spencer

unread,
Jan 17, 2003, 12:46:36 PM1/17/03
to
There's no need to do all of that POSTing, David. Just use Server.Transfer()
from one page to the next. It passes the Http Context of the current page to
the page you transfer to, allowing you access to all the properties of the
original page, including the Request.Form Collection.

HTH,

--
Kevin Spencer
Microsoft FrontPage MVP
Internet Developer
http://www.takempis.com
Complex things are made up of lots of simple things.

"David P. Donahue" <david....@firstsolution.com> wrote in message
news:Os9XCykvCHA.1640@TK2MSFTNGP09...

David P. Donahue

unread,
Jan 17, 2003, 12:50:13 PM1/17/03
to
Maybe I'm not seeing the bigger picture, or maybe I need to describe the
scenario more. First of all, the final destination for the POST is on
another site over which I have no control. They sent me documentation on
what fields need to be sent and that's all. So I'm guessing that will need
to be a POST operation, right? So then I'm just left with the question of
how to programatically add fields/values to that final POST from my
code-behind?

David P. Donahue
david....@firstsolution.com


"Kevin Spencer" <ke...@takempis.com> wrote in message
news:#lycQ$kvCHA.2868@TK2MSFTNGP12...

Kevin Spencer

unread,
Jan 17, 2003, 2:19:16 PM1/17/03
to
A WebForm submits to itself. You just write code that handles the data once
posted back, and uses Server.Transfer() to pass the data to the next page.
The LAST page can post to the remote form handler.

HTH,

--
Kevin Spencer
Microsoft FrontPage MVP
Internet Developer
http://www.takempis.com
Complex things are made up of lots of simple things.

"David P. Donahue" <david....@firstsolution.com> wrote in message

news:OoZqZDlvCHA.2568@TK2MSFTNGP12...

David P. Donahue

unread,
Jan 17, 2003, 3:18:50 PM1/17/03
to
Yes, but back to my original question... how can I do this from my
code-behind (using VB)? If you have, or know of any sample fode for
initiating a POST from code-behind than I'd really appreciate it. Or is
that basically what Server.Transfer() does? Like I said, the final
destination for the data is external, so it needs to be a standard POST
operation, not something that Microsoft made up.


David P. Donahue
david....@firstsolution.com

"Kevin Spencer" <ke...@takempis.com> wrote in message

news:#81a8ylvCHA.616@TK2MSFTNGP11...

Kevin Spencer

unread,
Jan 17, 2003, 3:45:35 PM1/17/03
to

You don't initiate a POST from your CodeBehind. Your last form simply posts
to the final form handler. It is not a Web Form. Of course, you COULD post
from your CodeBehind, by using the System.NetWebRequest class, if necessary.

HTH,

--
Kevin Spencer
Microsoft FrontPage MVP
Internet Developer
http://www.takempis.com
Complex things are made up of lots of simple things.

"David P. Donahue" <david....@firstsolution.com> wrote in message

news:#DGIcWmvCHA.2556@TK2MSFTNGP10...

Steve C. Orr, MCSD

unread,
Jan 17, 2003, 3:48:35 PM1/17/03
to
You can post to another web site using the WebRequest object.

Here's a couple examples:
http://www.dotnet247.com/247reference/msgs/19/95431.aspx
http://www.west-wind.com/presentations/dotnetWebRequest/dotnetWebRequest.htm

--
I hope this helps,
Steve C. Orr, MCSD
http://Steve.Orr.net


"David P. Donahue" <david....@firstsolution.com> wrote in message
news:Os9XCykvCHA.1640@TK2MSFTNGP09...

David P. Donahue

unread,
Jan 17, 2003, 3:57:59 PM1/17/03
to
The reason I want to initiate a POST from my code-behind is because I want
to be able to add fields and values to the POST programatically that aren't
visible to the client. Simply putting them on a form as hidden fields won't
accomplish this because they're still visible to the client if the client
really wants to see them.

I don't think I'm following the logic of your first three sentences there.
And, playing around with the System.Net.WebRequest class (I assume you meant
to include that second dot, since I found no System.NetWebRequest class),
I'm not seeing exactly how it can be used to create a POST request
(programatically add fields and values) and send it. Maybe I'm missing
something in the protocol, since I don't know a whole lot about POSTs in
general.


David P. Donahue
david....@firstsolution.com


"Kevin Spencer" <ke...@takempis.com> wrote in message

news:u23PLjmvCHA.2576@TK2MSFTNGP10...

David P. Donahue

unread,
Jan 17, 2003, 4:07:31 PM1/17/03
to

Perfect, thanks!


David P. Donahue
david....@firstsolution.com


"Steve C. Orr, MCSD" <st...@orr.net> wrote in message
news:#lGIEnmvCHA.2916@TK2MSFTNGP09...

0 new messages