first_page the funky knowledge base
personal notes from way, _way_ back and maybe today

MCAD/MCSD Notes: Chapter 4, Lesson 3; Navigating Between Forms

Lesson 3: Navigating Between Forms

The purpose of this lesson is to detail the ways Web forms are linked together through client-side hyperlinking (with the Hyperlink control and the window.open() script method) and server-side HTTP-context-switching (with Response.Redirect(), Server.Transfer() and Server.Execute() methods).

Hyperlink server controls do not fire server-side events. This lesson offers LinkButton or ImageButton controls as a substitute for the Hyperlink control when server-side events are needed. However, this replacement implies that any equivalent to the NavigateURL property will be lost when using the LinkButton or ImageButton controls. The lesson suggests that using Response.Redirect() with the LinkButton or ImageButton controls is an adequate workaround to this design.

The lesson goes on to warn us that implementing this design pattern is a security risk as ViewState information is no longer hashed and is as human-readable as HTML form POSTDATA.

The Server.Execute() method treats an ASP.NET page like a static method returning void. By default any HTML output is added to the output of the calling Page. When the optional writer argument is used, the output is sent to a System.IO.StringWriter object.

The Server.Execute() method effectively combines the calling Web form to another Web form. Any postbacks to the Web form being called will clear any postbacks in the calling Web form. So the lesson warns that, "...combining Web forms is mainly useful when the second Web form does not contain controls that trigger postback events."

mod date: 2005-04-12T19:45:33.000Z