Re: Session variables and POST method
From: Peter Foti (peter_at_Idontwantnostinkingemailfromyou.com)
Date: 02/09/04
- Next message: Curt_C [MVP]: "Re: return contents of url to asp page"
- Previous message: Bob Barrows [MVP]: "Re: Dates mm/dd/yyyy & dd/mm/yyyy giving a major headache"
- In reply to: Thomas Scheiderich: "Re: Session variables and POST method"
- Next in thread: Thomas Scheiderich: "Re: Session variables and POST method"
- Reply: Thomas Scheiderich: "Re: Session variables and POST method"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 9 Feb 2004 13:43:20 -0500
"Thomas Scheiderich" <tfs@deltanet.com> wrote in message
news:4027CEB5.2010403@deltanet.com...
> Peter Foti wrote:
>
> > "Thomas Scheiderich" <tfs@deltanet.com> wrote in message
> > news:402515A8.1080707@deltanet.com...
> >
> >>Peter Foti wrote:
> >>
> >>
> >>>"Thomas Scheiderich" <tfs@deltanet.com> wrote in message
> >>>news:4023F533.5050400@deltanet.com...
> >>>
> >>>
> >>>>I am trying to understand Session variables and ran into a question on
> >>>>how they work with data that is passed.
> >>>>
> >>>>I have an HTM file that calls an ASP file and sends the name either by
> >>>>GET or POST.
> >>>>
> >>>>When I find is that if I send the value by the GET method,
> >>>> response.write("From QueryString: " &
> >>>>Request.QueryString("usernamefromform") & "<br><br>")
> >>>>
> >>>> will get the variable fine, but
> >>>>
> >>>>Session("userName")=request.Form("userNameFromForm")
> >>>>response.write("Session variable = " & Session("userName"))
> >>>>
> >>>>doesn't work.
> >>>>
> >>>>If I use the POST method then it is reversed. Response.QueryString
> >>>>doesn't get anything and the Session code works.
> >>>>
> >>>>Why is this? I can't seem to find an explanation in my ASP books.
> >>>>
> >>>>
> >>>When using method GET, you can access the form values via the
> >>>Request.Querystring collection. When using method POST, you can access
> >>>
> > the
> >
> >>>form values via the Request.Form collection.
> >>>
> >>>
> >>Why is that?
> >>
> >>Aren't they both forms? I would have thought that the Request.Form,
> >>would still be able to get the data.
> >>
> >>I know that the difference between GET and POST is that you can see the
> >>data that is passed in the URL line in your browser, but you can't in
> >>the POST method.
> >>
> >
> > The method actually specifies which HTTP method is used to send the form
to
> > the processing agent. With the HTTP "get" method, the form data is
appended
> > to the URI specified by the action attribute, and this new URI is sent
to
> > the processing agent. With the HTTP "post" method, the form data is
> > included in the body of the form and sent to the processing agent.
Thus,
> > with the "get" method, your form data is transferred to the querystring,
and
> > with the "post" method, it remains in the form.
>
>
> This is a "just curious" question as I understand now what "post" does,
> but everyone says that the "post" method is appended to the form data
> and then passed to the processing agent.
>
> In the "get" method, the URL/URI with the query string appended after
> the "?" is sent to the processor. What is actually sent to the
> processor for "POST"? When you say the body of the form with the form
> data, are you talking about an HTML page that just has the form
> information (no graphics,tables etc.).
When a form is submitted for processing, some controls have their name
paired with their current value and these pairs are submitted with the form.
Those controls for which name/value pairs are submitted are called
successful controls.
Read this section of the spec for more details regarding how form data is
processed:
http://www.w3.org/TR/html4/interact/forms.html#h-17.13.3
In addition, you might read the relavent portions of the HTTP spec (section
9.5 for example):
http://www.ietf.org/rfc/rfc2616.txt
> I assume the data somehow gets sent to the client for the browser to
> handle. Where does the data get put for the client to handle for things
> such as putting into cookies as well as putting on the screen?
Why would you assume such a thing??? Form processing occurs on the server,
not on the client or browser. The server can tell the client that there is
a cookie, and that is handled by each browser individually (as far as where
is stores the cookie).
The spec should answer most of your questions.
Regards,
Peter Foti
- Next message: Curt_C [MVP]: "Re: return contents of url to asp page"
- Previous message: Bob Barrows [MVP]: "Re: Dates mm/dd/yyyy & dd/mm/yyyy giving a major headache"
- In reply to: Thomas Scheiderich: "Re: Session variables and POST method"
- Next in thread: Thomas Scheiderich: "Re: Session variables and POST method"
- Reply: Thomas Scheiderich: "Re: Session variables and POST method"
- Messages sorted by: [ date ] [ thread ]