Meaning of "Post a Page to a Page"
Meaning of "Post a Page to a Page"
am 25.01.2008 02:15:30 von Peter Schwartz
What does it mean - literally - to "post" a page? I understand that we have
the HTTP protocol and it's POST operation going on behind the scenes... but
I'm wanting to know what it means to "post a page to a page" -- specifically
in terms of what ASP.NET does with the HTTP POST.
To help clarify the understanding I am lacking and asking for here... I once
wrote an HTTP server using the Win32 API and it would sit there and listen
for HTTP POSTs on a specific port and respond accordingly. So I know that
nuts-n-bolts level of activity. But what I'm unclear on is what is going on
with ASP.NET. I suppose IIS is what is analogous to my HTTP listener... and
IIS is listening to port 80 (by default) and then, depending on the
requested resource, passes off the request to ASP.NET - and down the
pipeline it goes. And that is exactly where I get lost. What does ASP.NET do
to "post a page to a page"?
With ASP.NET, we have these concepts:
--- "postback" (ala .IsPostBack)
--- we have the idea of "posting a page to another page"
I understand that with the HTTP Post, some data is received by ASP.NET -
including an aspx page name. What is done with that page name at the end of
the point in the ASP.NET pipeline where something is done with that page
name? What is that something? Is it simply that ASP.NET runs any code-behind
logic of the requested page and sends it back down to the browser? Is it
anything more than that? And how does ASP.NET how to correctly set the value
of .IsPostBack?
Thanks.
Re: Meaning of "Post a Page to a Page"
am 25.01.2008 03:03:37 von nomailreplies
re:
!> how does ASP.NET how to correctly set the value of .IsPostBack?
public bool get_IsPostBack();
Declaring Type: System.Web.UI.Page
public bool get_IsPostBack()
{
if (this._requestValueCollection == null)
{
return false;
}
return !this._fPageLayoutChanged;
}
public bool IsPostBack { get; }
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibil ity.Hidden)]
public bool IsPostBack
{
get
{
if (this._requestValueCollection == null)
{
return false;
}
return !this._fPageLayoutChanged;
}
}
In other words, it checks to see if the RequestValueCollection is null.
If it is null, it's not a postback; if it's not, it is a postback.
What I would suggest is for you is to get yourself
a free copy of Lutz Roeder's Reflector for .Net :
http://www.aisto.com/roeder/dotnet/
....and use it to see which classes compose, not only the Postback handler,
but also any other handler you wish to figure out how it works.
Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"Robert Cramer" wrote in message news:ug3cH$uXIHA.3696@TK2MSFTNGP03.phx.gbl...
> What does it mean - literally - to "post" a page? I understand that we have the HTTP protocol and it's POST operation
> going on behind the scenes... but I'm wanting to know what it means to "post a page to a page" -- specifically in
> terms of what ASP.NET does with the HTTP POST.
>
> To help clarify the understanding I am lacking and asking for here... I once wrote an HTTP server using the Win32 API
> and it would sit there and listen for HTTP POSTs on a specific port and respond accordingly. So I know that
> nuts-n-bolts level of activity. But what I'm unclear on is what is going on with ASP.NET. I suppose IIS is what is
> analogous to my HTTP listener... and IIS is listening to port 80 (by default) and then, depending on the requested
> resource, passes off the request to ASP.NET - and down the pipeline it goes. And that is exactly where I get lost.
> What does ASP.NET do to "post a page to a page"?
>
> With ASP.NET, we have these concepts:
>
> --- "postback" (ala .IsPostBack)
>
> --- we have the idea of "posting a page to another page"
>
> I understand that with the HTTP Post, some data is received by ASP.NET - including an aspx page name. What is done
> with that page name at the end of the point in the ASP.NET pipeline where something is done with that page name? What
> is that something? Is it simply that ASP.NET runs any code-behind logic of the requested page and sends it back down
> to the browser? Is it anything more than that? And how does ASP.NET how to correctly set the value of .IsPostBack?
>
> Thanks.
>
>
Re: Meaning of "Post a Page to a Page"
am 25.01.2008 16:51:00 von Scott Roberts
> What does it mean - literally - to "post" a page?
I think it means exactly what you think it means. An HTTP POST is sent to
the server.
> I understand that we have the HTTP protocol and it's POST operation going
> on behind the scenes... but I'm wanting to know what it means to "post a
> page to a page" -- specifically in terms of what ASP.NET does with the
> HTTP POST.
>
> To help clarify the understanding I am lacking and asking for here... I
> once wrote an HTTP server using the Win32 API and it would sit there and
> listen for HTTP POSTs on a specific port and respond accordingly. So I
> know that nuts-n-bolts level of activity. But what I'm unclear on is what
> is going on with ASP.NET. I suppose IIS is what is analogous to my HTTP
> listener... and IIS is listening to port 80 (by default) and then,
> depending on the requested resource, passes off the request to ASP.NET -
> and down the pipeline it goes. And that is exactly where I get lost. What
> does ASP.NET do to "post a page to a page"?
>
> With ASP.NET, we have these concepts:
>
> --- "postback" (ala .IsPostBack)
>
> --- we have the idea of "posting a page to another page"
I'm not exactly certain what you mean by "posting a page to another page".
Are you referring to cross-page postbacks? Those are fairly uncommon, at
least in my experience.
> I understand that with the HTTP Post, some data is received by ASP.NET -
> including an aspx page name. What is done with that page name at the end
> of the point in the ASP.NET pipeline where something is done with that
> page name?
Well, I think the answer to that question is quite lengthy. The short answer
is the one you apparently already know - it runs the "code" (both
declarative and procedural) of the aspx page. The "code" produces HTML which
is sent back to the browser.
> What is that something? Is it simply that ASP.NET runs any code-behind
> logic of the requested page and sends it back down to the browser? Is it
> anything more than that? And how does ASP.NET how to correctly set the
> value of .IsPostBack?
I'm not actually 100% certain, but I've always assumed that it looks at the
VIEWSTATE (received as part of the HTTP POST).
RE: Meaning of "Post a Page to a Page"
am 25.01.2008 17:51:00 von brucebarker
its just like your server. iis looks at the extension (mappings) and when its
aspx, it pipes the request (or post) to the asp.net runetime. the runtime
send the response back to iis.
in the standard asp.net page request it does the following
1) parse the input request into a form, quesrystring and files collections
(looks at mime type to do this).
2) determines which aspx page to call. creates an instance of the page class
and runs the page life cycle events.
IsPostback is just a test if the hidden field "__viewstate" is in the forms
collection.
-- bruce (sqlwork.com)
-- bruce (sqlwork.com)
"Robert Cramer" wrote:
> What does it mean - literally - to "post" a page? I understand that we have
> the HTTP protocol and it's POST operation going on behind the scenes... but
> I'm wanting to know what it means to "post a page to a page" -- specifically
> in terms of what ASP.NET does with the HTTP POST.
>
> To help clarify the understanding I am lacking and asking for here... I once
> wrote an HTTP server using the Win32 API and it would sit there and listen
> for HTTP POSTs on a specific port and respond accordingly. So I know that
> nuts-n-bolts level of activity. But what I'm unclear on is what is going on
> with ASP.NET. I suppose IIS is what is analogous to my HTTP listener... and
> IIS is listening to port 80 (by default) and then, depending on the
> requested resource, passes off the request to ASP.NET - and down the
> pipeline it goes. And that is exactly where I get lost. What does ASP.NET do
> to "post a page to a page"?
>
> With ASP.NET, we have these concepts:
>
> --- "postback" (ala .IsPostBack)
>
> --- we have the idea of "posting a page to another page"
>
> I understand that with the HTTP Post, some data is received by ASP.NET -
> including an aspx page name. What is done with that page name at the end of
> the point in the ASP.NET pipeline where something is done with that page
> name? What is that something? Is it simply that ASP.NET runs any code-behind
> logic of the requested page and sends it back down to the browser? Is it
> anything more than that? And how does ASP.NET how to correctly set the value
> of .IsPostBack?
>
> Thanks.
>
>
>
Re: Meaning of "Post a Page to a Page"
am 25.01.2008 17:55:43 von nomailreplies
re:
!> I've always assumed that it looks at the VIEWSTATE (received as part of the HTTP POST)
What it looks for is whether there's an incoming stream.
public sealed class HttpPostedFile
{
// Fields
private string _contentType;
private string _filename;
private HttpInputStream _stream;
// Methods
internal HttpPostedFile(string filename, string contentType, HttpInputStream stream)
{
this._filename = filename;
this._contentType = contentType;
this._stream = stream;
}
public void SaveAs(string filename)
{
FileStream stream = new FileStream(filename, FileMode.Create);
try
{
if (this._stream.DataLength > 0)
{
stream.Write(this._stream.Data, this._stream.DataOffset, this._stream.DataLength);
}
stream.Flush();
}
finally
{
stream.Close();
}
}
// Properties
public int ContentLength
{
get
{
return this._stream.DataLength;
}
}
public string ContentType
{
get
{
return this._contentType;
}
}
public string FileName
{
get
{
return this._filename;
}
}
public Stream InputStream
{
get
{
return this._stream;
}
}
}
Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"Scott Roberts" wrote in message
news:ewx$To2XIHA.3940@TK2MSFTNGP05.phx.gbl...
>
>> What does it mean - literally - to "post" a page?
>
> I think it means exactly what you think it means. An HTTP POST is sent to the server.
>
>> I understand that we have the HTTP protocol and it's POST operation going on behind the scenes... but I'm wanting to
>> know what it means to "post a page to a page" -- specifically in terms of what ASP.NET does with the HTTP POST.
>>
>> To help clarify the understanding I am lacking and asking for here... I once wrote an HTTP server using the Win32 API
>> and it would sit there and listen for HTTP POSTs on a specific port and respond accordingly. So I know that
>> nuts-n-bolts level of activity. But what I'm unclear on is what is going on with ASP.NET. I suppose IIS is what is
>> analogous to my HTTP listener... and IIS is listening to port 80 (by default) and then, depending on the requested
>> resource, passes off the request to ASP.NET - and down the pipeline it goes. And that is exactly where I get lost.
>> What does ASP.NET do to "post a page to a page"?
>>
>> With ASP.NET, we have these concepts:
>>
>> --- "postback" (ala .IsPostBack)
>>
>> --- we have the idea of "posting a page to another page"
>
> I'm not exactly certain what you mean by "posting a page to another page". Are you referring to cross-page postbacks?
> Those are fairly uncommon, at least in my experience.
>
>> I understand that with the HTTP Post, some data is received by ASP.NET - including an aspx page name. What is done
>> with that page name at the end of the point in the ASP.NET pipeline where something is done with that page name?
>
> Well, I think the answer to that question is quite lengthy. The short answer is the one you apparently already know -
> it runs the "code" (both declarative and procedural) of the aspx page. The "code" produces HTML which is sent back to
> the browser.
>
>> What is that something? Is it simply that ASP.NET runs any code-behind logic of the requested page and sends it back
>> down to the browser? Is it anything more than that? And how does ASP.NET how to correctly set the value of
>> .IsPostBack?
>
> I'm not actually 100% certain, but I've always assumed that it looks at the VIEWSTATE (received as part of the HTTP
> POST).