Re: breaking the model



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
> =----


.



Relevant Pages

  • [PATCH 16/22] trivial: fix typo "that that" in multiple files
    ... block, switch to user-mode execution, or enter the idle loop. ... as soon as a CPU is seen passing through any of these ... that submitted the just completed request are examined. ...
    (Linux-Kernel)
  • Java Soft-Real-Time Processor
    ... request will take no more than what the process specifies. ... programmer defines a timeout ... how can the Processor interrupt execution ... Process Stages are divided in two categories: blocking and non- ...
    (comp.realtime)
  • [Full-disclosure] Zabbix Multiple Frontend CSRF (Password reset & command execution)
    ... Multiple Cross-Site Request Forgery vulnerabilities exist that can allow for the following ... Reset Admin Password: ... Execution of Shell Commands: ... be executed has to be created and then that command has to be executed. ...
    (Full-Disclosure)
  • Zabbix Multiple Frontend CSRF (Password reset & command execution)
    ... Multiple Cross-Site Request Forgery vulnerabilities exist that can allow for the following ... Reset Admin Password: ... Execution of Shell Commands: ... be executed has to be created and then that command has to be executed. ...
    (Bugtraq)
  • Re: variable scope in a webform only
    ... That's because Page class is instantiated for every request so classes declared on page class body, are in the same instance only during a single request. ... How do you declare abc inside the page class? ... I mean, I d like to see that variable from all the Sub of that webform code, but if I window.open another instance of that webform, that variable should be independant even if the name is the same. ...
    (microsoft.public.dotnet.framework.aspnet)