Blog Home  Home Feed your aggregator (RSS 2.0)  
What did you learn today? - 70-551 Section II, Part III - Web Applications
Phil Denoncourt's Technology Rants
 
 Friday, February 24, 2006

UPGRADE: MCAD Skills to MCPD Web Developer by Using the Microsoft .NET Framework

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.

There are two ways to redirect users to another web page.  Response.Redirect, which aborts processing the current page and tells the user's browser to go somewhere else, Server.Transfer and Server.Execute.  There is the PostBackURL property for button controls, but I consider that client side functionality.  Mike Pope has a writeup about the advantages of Server.Transfer vs. PostBackURL. 

To detect the browser type, use the Browser property on the response object.  There are plenty of new properties in the HttpBrowserCapabilities object. Mostly to support mobile device features.

Unhandled exceptions at the Page level are supposed to be handled in the Error event of the page.  Victor Garcia Aprea has an post on the exceptions to this rule.

To access the header, use the methods on the Response property, AppendHeader (AddHeader is obsolete) and ClearHeaders methods; Headers property.

Cross page postbacks are a new feature.  To make use of the them, set the PostBackURL property to a different page.  There are a few good writeups on this feature.  Scott Allen at OdeToCode, Naveedullah Khan at DotNetPakistan, Ting-hao Yang at MSDN.

To assign focus to a control, set the DefaultFocus attribute of the Form element to the HTML id of the control to get focus.  Scott Guthrie has a post on this feature.  There is also a Focus method on controls.

The IsPostBack feature hasn't changed.  Understand that when you use Server.Transfer, IsPostBack in the transferred page is set to the value of the initial page.

The Page and Application objects still exist.  The Page has its own Cache for Page specific information,  Application has it's own cache for the entire website.

To avoid round trips using client side script, you can either use the Validation controls, or write your own script, registering it by calling RegisterClientSideScript, RegisterStartupScript, or RegisterOnSubmitStatement.

The Async feature allows you to send requests to get data.  When the data is returned, you then resume building the page.  Fritz Onion has a writeup on the feature.  Bipin Joshi also has a good article.

To convert an HTML Server control back to a plain old HTML element, just remove the RunAt=Server attribute.  Obviously this won't work with Web Controls.

Next up-> Data Bound Controls

Friday, February 24, 2006 2:43:46 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]   Certifications  | 
Comments are closed.
Copyright © 2008 Phil Denoncourt III. All rights reserved.
DasBlog 'Portal' theme by Johnny Hughes.
Pick a theme: