Exam 70-553 - Program a Web application.

Section 2

  • Part 1
    • Topic 3

Program a Web application.

  • Redirect users to another Web page by using a server-side method.
  • Detect browser types in Web Forms.
  • Ascertain the cause of an unhandled exception at the page level.
  • Programmatically access the header of a Web page.
  • Implement cross-page postbacks.
  • Assign focus to a control on a page when the page is displayed.
  • Avoid performing unnecessary processing on a round trip by using a page's IsPostBack property.
  • Access encapsulated page and application context.
  • Avoid unnecessary client-side redirection by using the HttpServerUtility.Transfer method.
  • Avoid round trips by using client-side scripts.
  • Use a page's Async attribute to create a page that has built-in asynchronous capabilities.
  • Convert HTML server controls to HTML elements.


Redirecting users to other pages through Server Side Methods is accomplished through Response.Redirect, HttpServerUtility.Transfer and Server.Transfer.

The Request object now exposes a Browser Object which can be used to determine the Browser type and capabilities.

At the page level you can subscribe to the Page OnError event which will allow you to get the last error by using Server.GetLastError to get the last exception that occurred.

You can access the header of a web page through the HTMLHead Control as long as you make the Head tag have the RunAt=Server Attribute. You can use it to modify the title, links, scripts, etc.

To Implement Cross Page Postbacks in ASP.Net 2.0 by setting the PostBackUrl property of the button control to the page you want your web form to post to. In the Posted Page you can access the calling page through the PreviousPage property which would be null if it wasn’t a cross page postback. The one tricky situation that could occur is that Validation on the Server side will not occur unless you call the PreviousPage.IsValid method to make sure that the post passed validation.

There are three ways to set focus programmatically using ASP.Net 2.0. You can use the Page.SetFocus Method with the ControlID of the Control you want to set the focus on, You can call the Focus method of the control itself, or you can set the DefaultFocus property of the Form element.

The IsPostBack Property lets you know programmatically if the page was posted back and you can avoid refreshing data that was persisted to Viewstate.

The HttpServerUtility.Transfer method works like the Response.Redirect method but without the extra client side trip.

In ASP.Net you can now set a PageDirective Attribute of Async to true to use the IHttpAsyncHandler. You then can use the AddOnPreRenderComplete method to set a method to be called on the Begin and End of the PreRender event.

You can convert HTML Server controls to html elements by unchecking the runat server property or removing the runtat=”server” attribute from the control in html view.

Other Resources & Links:

Design Considerations for Cross Page Post Backs in ASP.NET 2.0

How to: Detect Browser Types in ASP.NET Web Pages

Web Application Error Handling in ASP.Net

HTMLHead Class

Focus in ASP.Net Controls

HttpServerUtility.Transfer Method

Wicked Code: Asynchronous Pages in ASP.Net 2.0

How to: Convert HTML Server Controls to HTML Elements

Exam 70-553 - Implement data-bound controls.

Exam 70-553 - Configure settings for a Web application.