Re: breaking the model
- From: "Kevin Spencer" <kevin@xxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 17 Dec 2005 21:27:18 -0500
Sure Mike,
> When I use Server.Transfer( "some.aspx") or
> Server.Transfer("some.aspx", true), there doesn't seem to be any
> difference in functionality. The docs say
Yes, the docs are a bit confusing. Setting the second parameter to false is
what clears the Collections.
The docs also say that Server.Transfer stops execution of the previous
> webform. If that is the case, then how can I can a reference to it? I
> guess I am thinking that stopping execution is
> equivalent to destroy.
Exactly. It stops the previous Page class from continuing its execution. The
class is not destroyed. The difference is that the previous page is no
longer processing the Request. You have "transferred" execution to the new
Page class.
> One last thing, the URL in the browser still points to the calling
> webform page.
That is true, and correct. Server.Transfer is a server-side transfer of
execution. The execution of the HTTP Request is handed off to another Page
class. The Request is not changed. The difference between Server.Transfer
and Response.Redirect, is that Response.Redirect actually sends a Response
back to the client browser, telling it to request another URL. Therefore,
the URL of the Request changes, as it is actually a second Request from the
client. Server.Transfer only changes the server-side handler of the current
HTTP Request.
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.
"Mike Gaab" <mike-g@xxxxxxxxxxx> wrote in message
news:1134854031_3059@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
>
> "Kevin Spencer" <kevin@xxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:OmgZBp0AGHA.3408@xxxxxxxxxxxxxxxxxxxxxxx
>> Hi Mike,
>>
>> The ASP.Net object model is designed to work something like a Windows
>> Form, and emulate state as well as events by various mechanisms, such as
>> PostBack (the WebForm submitting to itself), ViewState, and so on. As
>> HTTP is stateless, there is a rather substantial infrastructure to
>> support this emulation.
>>
>> It is really quite elegant, all things considered. So, if you can get
>> your head around the object model, you can see that Server.Transfer and
>> Response.Redirect are more in line with that object model. The browser
>> represents the interface, and the server is the business logic that
>> drives it. Now, that said, it is certainly possible to add an additional,
>> non-server form to a page, and have that form post to another ASP.Net
>> page in the same application. However, this more or less breaks the
>> object model, as anything outside the WebForm is not a Server Control,
>> and does not follow the object model. Having another form on a page is
>> sometimes useful for posting to another Application or Domain, but other
>> than that, I think that once you get used to the ASP.Net object model, it
>> will "click" and you will feel quite comfortable with it.
>>
>> There is something to be said for convention. It provides common ground,
>> and eliminates the necessity to remember a variety of different
>> methodologies, as well as making development in a team, or taking on work
>> from another developer much easier (less of a learning curve). I would
>> suggest you stick with it, and see if you don't grow to like it a lot.
>>
>
> Hi Kevin,
>
> Yeah, I agree.
>
> A few questions...
>
> When I use Server.Transfer( "some.aspx") or
> Server.Transfer("some.aspx", true), there doesn't seem to be any
> difference in functionality. The docs say that the boolean preserves form
> and query string data from the calling webform but I can still get at the
> form data by either using the Request object or by getting a reference of
> the calling webform via the Context.Handler property
> and calling the appropriate get method(s).
>
> The docs also say that Server.Transfer stops execution of the previous
> webform. If that is the case, then how can I can a reference to it? I
> guess I am thinking that stopping execution is
> equivalent to destroy.
>
> One last thing, the URL in the browser still points to the calling
> webform page.
>
> Please explain. Thanks.
>
> Mike
>
>
> ----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet
> News==----
> http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+
> Newsgroups
> ----= East and West-Coast Server Farms - Total Privacy via Encryption
> =----
.
- Follow-Ups:
- Re: breaking the model
- From: Mike Gaab
- Re: breaking the model
- References:
- breaking the model
- From: Mike Gaab
- Re: breaking the model
- From: Kevin Spencer
- Re: breaking the model
- From: Mike Gaab
- breaking the model
- Prev by Date: keys from image
- Next by Date: Re: Shopping cart Server Application Unavailable - random
- Previous by thread: Re: breaking the model
- Next by thread: Re: breaking the model
- Index(es):
Relevant Pages
|