Showing posts with label Page Directives. Show all posts
Showing posts with label Page Directives. Show all posts

Tuesday, October 13, 2009

Chapter 5-Lesson 1

  • Masterpages derive from Masterpage and have a @Master directive.
  • ContentPlaceholder can also be placed in the head section.
  • asp:Content tag defines the substitution content for a ContentPlaceholder in Page that derives from a Masterpage.
  • Everything (except the Page directive) inside an ASPX page that derives from a Masterpage should be enclosed within a Content control.
  • Settings on the masterpage usually take priority over settings made on content pages.
  • Masterpages may be applied at individual page level, folder level or entire web application level. This is done respectively using @Page directive or pages section in web.config file.
  • Content pages can reference/access public properties defined in the Masterpage class.
  • @MasterType directive should be defined in the content page where masterpage properties need to be accessed. This enables the use of Master class to access Masterpage's public properties.
  • We may reference Masterpage controls from within content pages using Master.FindControl( ) method.
  • Events first get fired for Masterpage and then for content page.
  • Masterpages can be nested into one another.
  • Page.MasterPageFile property may be used to switch masterpages programatically. We only need to make sure all the different masterpages provide exactly same number and names of content placeholders to ensure compatibility.

Monday, September 21, 2009

Chapter 3-Lesson 2

  • We may use Hyperlink control to enable Client-side Navigation within the page. No data is posted to the newly requested page, so we may need to use QueryStrings.
  • Page.PostBackUrl property is used for Cross-page Posting.
  • When a cross-page post is made, data from first page is posted to the second page. The second page may access that data using Page.PreviousPage property.
  • We may use properties to encapsulate controls on a page so that they could be accessed from another page as strongly typed values during a cross-page posting.
  • To access such porperties in the posted page, add PreviousPageType directive after the Page directive and set its VirtualPath attribute. (Page 169 for exact usage)
  • Response.Redirect( ) method is used to cause a Client-side Browser redirect. This is similar to using Hyperlinks as the browser is sent an HTTP 302 message with the URL to redirect.
  • Server.Transfer( ) method is used to cause a Server-side Page Redirection. PreviousPage property is populated for the new page in this case.
  • Sitemap class is used to access Web.sitemap (or other such) files from code. It has three properties namely Title, Url and Description.
  • Menu, TreeView and SiteMapPath are three navigational controls that use Sitemap files.
  • SitemapPath connects itself to the Sitemap file automatically. It can be put on a masterpage where it could check (automatically) current page on which it is displayed and show its bread-crumb trail.

Thursday, September 10, 2009

Chapter 1-Lesson 1-2-3

  • For remotely servers, the server must have Frontpage Server Extensions installed for Visual Studio to connect to it. (This will be required when using HTTP Server during Website creation in Visual Studio)
  • Solution (.sln) files are text files associated only with ASP.NET Web Application Projects (and not ASP.NET Website template) and contains information about information such as target framework, default language, list of project dependencies and so on.
  • Solution User Options (.suo) files is a binary file that contains breakpoints and watch window settings, tasks list and VS window locations for current user.
  • Special folders (usually prefixed with word App_) are protected by ASP.NET from direct user access. This excludes App_Themes folder.
  • A typical ASPX page is made up three parts, namely: Page Directives, Code (or Code-Behind) and Layout.
  • If we place all website files on server, it is referred to as Dynamic Compilation, i.e. the code will get compiled automatically by server the first time a user request is made.
  • On the other hand ASP.NET also allows Pre-compilation which compiles code into assemblies and leaves layout files intact. This removes the first user performance hit but is difficult to manage (as the entire website would need re-compilation for even a small change made to code)
  • Machine.config file contains settings for all .NET application types including Console, Windows and Web.
  • Settings related to the Web Server are stored in Root Default web.config file which resides in the same directory as Machine.config. (Typically %SystemRoot%/Microsoft.Net/Framework//CONFIG/ ) Settings in this file may override some settings from Machine.config
  • Each website may then have an optional web.config at its own root folder. This file may further override Root Default web.config settings.
  • Sub-directories within a website may also their respective web.config files. The runtime effectively flattens this layered configuration model (from Machine.config to Sub-Directory specific web.config) to determine the final settings for pages contained in that folder.
  • The WSAT (Website Administration Tool), accessible in VS 2008 through Website -> ASP.NET Configuration allows to visually change web.config settings.