I’m going to be taking the Web Application Development with Microsoft .NET Framework 4 in the very near future. Since I’m going to be scribbling a few notes and studying up, it seemed like I’d publish my studies. With that, here is round 1. My intent is to study each focus area and make a blog post about it. Beware, these could be some rather messy blog entries, I’ll try to keep them somewhat cohesive though. (Note, the base of these notes are from the actual 70-515 curriculum and also Niall Merrigan’s Blog Entry “MCTS Web Applications .NET 4 – 70-515 – Objectives List Part 1” helped a lot! I’ve of course added my extra 2 cents to most of these. Cheers!)
Focus Point: Developing Web Forms Pages
Configure Web Forms Pages
A page directive is a page-specific attribute used by the ASP.NET page parser and compiler. Some of these attributes I’ve linked and detailed below:
- Page.AsyncMode Property – Sets a value indicating the page is processed synchronously or asynchronously. The AsyncMode property is set by the Page parser when code for the page is generated. Use the Async attribute in @ Page directive to set this value. Asynchronous pages do not work when the AspCompat attribute is set to true or the Transaction attribute is set to a value other than Disabled in the @ Page directive.
- Page.AsyncTimeout Property – Gets or sets a value indicating the time-out interval used when processing asynchronous tasks. The asynchronous time-out of the page represents the amount of time that the page will wait to perform asynchronous tasks. In most circumstances, do not set this property in code. Set the page asynchronous time-out interval using the pages element of the Web configuration file or in the @ Page directive. Values set in the page configuration section are overwritten by the page directive. Define your asynchronous task using the PageAsyncTask class and register a beginning, an ending, and a time-out handler. If the asynchronous task does not complete in the time interval specified, the time-out handler will be invoked.
- Page.AspCompatMode Property – Sets a value indicating whether the page can be executed on a single-threaded apartment (STA) thread. This allows the page to call STA components, such as components developed with Visual Basic 6.0. Setting this property to true also allows the page to call COM+ components that require access to the unmanaged ASP built-in objects. These are accessible through the ASP ObjectContext object or the OnStartPage method. In most circumstances, do not set this property in code. Set the aspcompat attribute to true using the @ Page directive in the .aspx file. When the page is requested, the dynamically generated class sets the property.
- Page.Buffer Property – Sets a value indicating whether the page output is buffered. In most circumstances, do not set this property in code. Set the Buffer attribute to true using the @ Page directive in the .aspx file. When the page is requested, the dynamically generated class sets the property.
- Control.ClientIDMode Property – Gets or sets the algorithm that is used to generate the value of the ClientID property. The values are AutoID which generates the value by concatenating the ID values of each parent naming container with the ID value of the control, seperated by an underscore character. The Static value sets the value statically and makes the control the top of the hierarchy of naming containers if it is a container. Predictable algorithm is used for controls that are data-bound controls and concatenates the ClientID value of the parent with the ID value of the control. Inherit sets it to the parent control.
- Page.ClientTarget Property – Gets or sets a value that allows you to override automatic detection of browser capabilities and to specify how a page is rendered for particular browser clients. If you do not set the ClientTarget property, the HttpBrowserCapabilities object associated with the Page.Request property reflects the browser capabilities associated with the value (alias) that you provide. uplevel, which specifies
- CompilationMode Enumeration – Defines constants that specify how ASP.NET should compile .aspx pages and .ascx controls. Members include; Auto sets ASP.NET to not compile the page if possible, Never states the page will not be dynamically compiled, and Always sets ASP.NET to compile every time.
- Control.EnableViewState Property – This one has been the disdain of many serious web developers, as the view state becomes a horrifying beast to deal with. But I digress, it may appear on the test so know about it. 🙂 This property gets or sets a value indicating whether the server control persists its view state, and the view state of any child controls it contains, to the requesting client.
- Page.EnableViewStateMac Property – Gets or sets a value indicating whether ASP.NET should check message authentication codes (MAC) in the page’s view state when the page is posted back from the client.
- Page.ErrorPage Property – Gets or sets the error page to which the requesting browser is redirected in the event of an unhandled page exception.
- Page.MasterPageFile Property – Gets or sets the file name of the master page.
- Page.MetaDescription – Gets or sets the content of the “description” meta element.
- Page.MetaKeywords – Gets or set the content of the “keywords” meta element.
- Page.Theme Property – Gets or sets the name of the page theme.
- ViewStateEncryptionMode Enumberation – Specifies whether view-state information is encrypted; Auto sets the encryption by calling the RegisterRequiresViewStateEncryption method, Always sets it to encrypt always and Never does not encrypt even if the control requests it.
- Control.ViewState Property – Gets or sets the view-state mode of this control.
- Control.ViewStateMode Property – Gets or sets the view-state mode of this control.
- Compiler.WarningLevel Property – Gets the compiler warning level.
- Saving and reading values in View State: Save Values / Read Values
- Auto Event Wire Up – i.e. ASP.NET Web Server Control Event Model.
- PageSection.EnableEventValidation Property – Gets or sets a value that specifies whether event validation is enabled.
- General configuration settings (ASP.NET) – This topic covers web.config files and setting up configuration sections within this file. Some of the topics to be familiar with include; connectionStrings, system.web, configSections, appSettings, location, System.Configuation, and System.Web.Configuration.
- XHTML Standards in Visual Studio and ASP.NET
- Editing ASP.NET Configuration Files – Case-sensitivity, custom sections, remote configuration files, etc.
Implement Master Pages and Themes
- ASP.NET Themes and Skins – A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in a Web Application, across an entire Web Application, or across all Web Applications on a server. A Theme and Control Skins are setup using CSS (Cascading Style Sheets) and other elements based on the page or individual controls.
- Themes vs. Cascading Style Sheets – Themes are similar to cascading style sheets, and can even use CSS, themes go one step further an enable skinning individual complex controls such as treeviews.
- Control.SkinID Property – Gets or sets the skin to apply to the control.
- Passing information between content and master pages – 4GuysFromRolla site link. These guys, from way way back when I started programming have always had some seriously great content.
- The age old method of applying the themes programmatically… How to: Apply ASP.NET Themes Programmatically.
- ASP.NET Web Page Resources Overview – For multiple languages setting up localization is of key importance. Resource files are broken into global and local resources. A *.resx file is a global localization resource while each of the controls on a page have a separate local resource file.
- Localizing Resources for Component Libraries Overview – Localizing client scripts and script resources in assemblies, and using scriptmanager to manage scripts in a central location.
Handle Page Life Cycle Events
- Page.IsPostBack Property – Gets a value that indicates whether the page is being rendered for the first time or is being loaded in response to a postback. For an explanation of the difference between postbacks and callbacks, see Implementing Client Callbacks Programmatically Without Postbacks in ASP.NET Web Pages. Also see the How-To: Determine How ASP.NET Web Pages Were Invoked.
- Page.IsValid Property – Gets a value indicating whether page validation succeeded. For this property to return true, all validation server controls in the current validation group must validate successfully. Check this property only after calling the Page.Validate method, or set the CausesValidation property to true on the OnServerClicke event handler of the ASP.NET Server control that initiates form processing. Also be aware of how to disable validation or display server side custom validation messages for ASP.NET server controls.
- ASP.NET Page Life Cycle Overview, and also check out the How-to: Add Controls to an ASP.NET Web Page Programmatically.
- Be sure to review these events that can be overridden; Page.PreInit Event, Control.Init Event, Page.InitComplete Event, Page.PreLoad Event, Control.Load Event, Page.LoadComplete Event, Control.PreRender Event, Page.PreRenderComplete Event, Page.SaveStateComplete Event, Control.Render Method, and the Control.Unload Event.
- ASP.NET has a caching mechanism that allows storage of objects in memory. This caching is implemented by the Cache Class. The primary two functionalities of the cache are to add items to the cache and to retrieve values of cached items. Also you can delete an item if necessary.
- Caching ASP.NET Pages – There is a way with ASP.NET that caches actual page requests. Setting the Cacheability of a Page must be set. Multiple Versions of a Page can also be cached. On a more discrete level parts of a page can be cached. Read Caching Portions of an ASP.NET Page for more information.
- For a thorough overview of ASP.NET Caching, read the http://msdn.microsoft.com/en-us/library/ms178597(VS.100).aspx on the topic.
- Other topics under this item to review are; AggregateCacheDependency Class, Caching in ASP.NET with the SqlCacheDependency Class, and How to: Cache Page Output with File Dependencies.
There are a few more topics for this section of the test, I’ll follow up with the remainder of those notes, and move on to the next topic section. Enjoy…