Help with POST method 
Author Message
 Help with POST method

I have a ASPX form and I want call to other APX form, and I want read
from the second form the form fields from de first form with the POST
method (no parameters in the navigator line: this is very important).
The call to the second form is in the button server component,

How call from the first form to the second ?
How read the first form-form fields from the second form?

Thanks.



Fri, 25 Feb 2005 21:14:36 GMT  
 Help with POST method
Josep,

    The easiest way would be to use an HttpWebRequest.  However, this isn't
the best way.  What you really should do is separate out the logic from the
page into a class, create an instance of that class, and get the values that
you want from that.  This will be more efficient, because it will keep you
from having to issue a network request and marshall all that data.

    Hope this helps.

--
               - Nicholas Paldino [.NET/C# MVP]


Quote:
> I have a ASPX form and I want call to other APX form, and I want read
> from the second form the form fields from de first form with the POST
> method (no parameters in the navigator line: this is very important).
> The call to the second form is in the button server component,

> How call from the first form to the second ?
> How read the first form-form fields from the second form?

> Thanks.



Fri, 25 Feb 2005 21:14:37 GMT  
 Help with POST method
Josep, you just need to have a <form> with a method="POST" and
action="SecondPage.aspx".  You can access the values in the form using the
Request.Form object.

--
Greg
http://www.claritycon.com/


Quote:
> I have a ASPX form and I want call to other APX form, and I want read
> from the second form the form fields from de first form with the POST
> method (no parameters in the navigator line: this is very important).
> The call to the second form is in the button server component,

> How call from the first form to the second ?
> How read the first form-form fields from the second form?

> Thanks.



Fri, 25 Feb 2005 21:22:56 GMT  
 Help with POST method
Greg, you are right, but he wants to have the post come from the code in
the codebehind.  I am looking to do that as well.  I would like to use
the post-back functionality, but when I'm done to post to a new page.


Sat, 26 Feb 2005 02:36:53 GMT  
 Help with POST method
On Mon, 9 Sep 2002 13:36:53 -0500, jonnylbluejeans

Quote:

>Greg, you are right, but he wants to have the post come from the code in
>the codebehind.  I am looking to do that as well.  I would like to use
>the post-back functionality, but when I'm done to post to a new page.

Well the code behind could (unless IIS wont let it run) just use web
client to do the post, but this would be invisible to the client
browser,  I cant see how it would get the browser to re-direct to the
posted to page, unless it was a multiple step job:

Browser request page 1>IIS
IIS Create Page1
IIS page 1 +cookie(session state?)>Browser

User fills in page 1 of form:

Browser POST+cookie>IIS Page1 handler

IIS Page1 handler gets data, then does WebClient POST+cookie>Page2

IIS does re-direct to page 2, or round trip request>Browser

Browser requests page 2>IIS Creates Page2 using cookie to re-retrieve
data already posted to it,

or if redirect [single trip]

browser is given page 2 as created with cookie.... (as real page name
is hidden in a re-direct, the page could be unique'd somehow)

Just guessing mind.
Jonathan Wilson,
AS/400 Consultant. (UK)
+44 (0)115 9192648
C#, .NET Newbe



Sat, 26 Feb 2005 20:22:35 GMT  
 Help with POST method


Quote:
> On Mon, 9 Sep 2002 13:36:53 -0500, jonnylbluejeans

> >Greg, you are right, but he wants to have the post come from the code in
> >the codebehind.  I am looking to do that as well.  I would like to use
> >the post-back functionality, but when I'm done to post to a new page.

> Well the code behind could (unless IIS wont let it run) just use web
> client to do the post, but this would be invisible to the client
> browser,  I cant see how it would get the browser to re-direct to the
> posted to page, unless it was a multiple step job:

> Browser request page 1>IIS
> IIS Create Page1
> IIS page 1 +cookie(session state?)>Browser

> User fills in page 1 of form:

> Browser POST+cookie>IIS Page1 handler

> IIS Page1 handler gets data, then does WebClient POST+cookie>Page2

> IIS does re-direct to page 2, or round trip request>Browser

> Browser requests page 2>IIS Creates Page2 using cookie to re-retrieve
> data already posted to it,

> or if redirect [single trip]

> browser is given page 2 as created with cookie.... (as real page name
> is hidden in a re-direct, the page could be unique'd somehow)

> Just guessing mind.
> Jonathan Wilson,
> AS/400 Consultant. (UK)
> +44 (0)115 9192648
> C#, .NET Newbe

There are definitely ways AROUND doing what we want to do, like
Server.Transfer for instance.  BUT, my problem with Server.Transfer is
that this implies that the page receiving the HTTP Post will only be
called by page (object) that you hard code in there.  (Very long to
explain, but do a search on Server.Transfer and you will see what I
mean.)

There HAS to be a way to use PostBacks and do a redirect to another page
while POSTing form fields without declaring a reference to FORM1 from
FORM2.  I need FORM1, FORM3, FORM4, etc to be able to post to FORM2.  

Anyone got a good answer to this?



Sun, 27 Feb 2005 23:02:58 GMT  
 Help with POST method
 am not sure what the limit in Server.Transfer is supposed to be :-)

Basically , we use Server.Transfer in a CMS scenario to transfer request
processing to a template page - in combination with RewriteURL to change the
ASP.NET internal presentation of the URL things work fine here.

Thomas Tomiczek
THONA Consulting Ltd.
(Microsoft MVP C#/.NET)


Quote:


> > On Mon, 9 Sep 2002 13:36:53 -0500, jonnylbluejeans

> > >Greg, you are right, but he wants to have the post come from the code
in
> > >the codebehind.  I am looking to do that as well.  I would like to use
> > >the post-back functionality, but when I'm done to post to a new page.

> > Well the code behind could (unless IIS wont let it run) just use web
> > client to do the post, but this would be invisible to the client
> > browser,  I cant see how it would get the browser to re-direct to the
> > posted to page, unless it was a multiple step job:

> > Browser request page 1>IIS
> > IIS Create Page1
> > IIS page 1 +cookie(session state?)>Browser

> > User fills in page 1 of form:

> > Browser POST+cookie>IIS Page1 handler

> > IIS Page1 handler gets data, then does WebClient POST+cookie>Page2

> > IIS does re-direct to page 2, or round trip request>Browser

> > Browser requests page 2>IIS Creates Page2 using cookie to re-retrieve
> > data already posted to it,

> > or if redirect [single trip]

> > browser is given page 2 as created with cookie.... (as real page name
> > is hidden in a re-direct, the page could be unique'd somehow)

> > Just guessing mind.
> > Jonathan Wilson,
> > AS/400 Consultant. (UK)
> > +44 (0)115 9192648
> > C#, .NET Newbe

> There are definitely ways AROUND doing what we want to do, like
> Server.Transfer for instance.  BUT, my problem with Server.Transfer is
> that this implies that the page receiving the HTTP Post will only be
> called by page (object) that you hard code in there.  (Very long to
> explain, but do a search on Server.Transfer and you will see what I
> mean.)

> There HAS to be a way to use PostBacks and do a redirect to another page
> while POSTing form fields without declaring a reference to FORM1 from
> FORM2.  I need FORM1, FORM3, FORM4, etc to be able to post to FORM2.

> Anyone got a good answer to this?



Mon, 28 Feb 2005 00:40:13 GMT  
 Help with POST method

Quote:
>There HAS to be a way to use PostBacks and do a redirect to another page
>while POSTing form fields without declaring a reference to FORM1 from
>FORM2.  I need FORM1, FORM3, FORM4, etc to be able to post to FORM2.  

>Anyone got a good answer to this?

mmmm... Lets see if i've got this correct (and please excuse my
limited knowledge, and thinking out loud style).

User requests form 1
IIS sends form 1 to user
User enters fields, presses send.

(a) At this point, either
you want the browser to post to form 2
or
browser posts to form 1 and the server posts the form 1 data to form 2

then IIS sends form 3 to the user
user enters fields, presses send.

then same as (a)

Problem is that, as I understand aspx, the aspx and aspx.cs are
"linked" and unless you tell form1.aspx/aspx.cs and form2.aspx/aspx.cs
about each other then they cant exchange data?

This obviously isnt a problem with "gets" because the IIS system, or
aspx page, can just extract the data from the URL.... but with posts
it falls down with things like "object set to null instance" when
trying to get the data from a "control"?

I guess part of the problem is that IIS "cheats" by using that horible
string that duplicates most of the visible data in an internal format
(fine untill you get killobytes sent while filling in .gov forms that
run to 30 pages on a 28.8 dial up!), and uses this string to link
fields and state etc in such a way as to pretend that you have a
constant link between multiple pages and browser.

I guess that if you use, and forgo the extra flexibility, of IIS form
controls for page two and instead just use standard HTML tags then
this session state string might not be used, inwich case the IIS would
probably extract the data using "normal" methods, ie: pull data from
POST-FIELD/data elements (however thats done normally).

If that didnt work, and you actually wanted the IIS to post accepted
user data into another "invisible" page, how about creating a soap(i
believe its called... some new fangled xml thingie) service and get
the form1.aspx.cs to post to that instead

mmmm, thinking again... if what you are trying to do is having the
browser presented with 1 large form broken into 4 smaller ones with
the last one being the final page, then you could always go "the old
way" by having hidden fields on page 2 & 3 & 4, page 1 is sent to the
server that sets up page 2's hidden fields, and new blank ones, and
sends them to the browser... etc. finally page 4's data is sent back
via the visible and invisible "real fields," not via the session/state
string....

I'm guessing that IIS uses the special string to pass the previous
pages "object data" so with hidden fields it wont be pretending to
send a page class object.... but I'll be honest, I know very little
about how aspx "works" even though I can code a simple page.

It does seem rather daft that its not possible to code up a normal
browser stream and just post that to IIS for posts in the same way you
can with the URL&key?data streams.... which if true is gona kybosh my
automated testing as I want to move it from the URL&? as it is at
present to POSTs... oh well !

Jon

Jonathan Wilson,
AS/400 Consultant. (UK)
+44 (0)115 9192648
C#, .NET Newbe



Mon, 28 Feb 2005 02:58:11 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. Need help with POST method to an asp page

2. Help with OutputTo SendTo Action/Method - Multi-post

3. POST method NOT WORKING... pls help

4. need help with VB "POST" Method

5. Second Post - (First Post is Gone) - Please Help!!

6. OpenCurrentDatabase Method - 2nd Post

7. FollowHyperlink in Post Method

8. Post-method question

9. problem post method

10. post method

11. Refreshing a POST Method with IE 6.0

12. automate Post method on html form

 

 
Powered by phpBB® Forum Software