George's Blog

Learning to Geek...

  Home  |   Contact  |   Syndication    |   Login
  6 Posts | 0 Stories | 3 Comments | 0 Trackbacks

News

Twitter












Archives

Other Blogs

My week long look into the web.config file is almost done. On top of all the other studying that I am doing in all things .NET I am focusing on one item per week and reading extra, coding extra and blogging about that particular item. So this week was configurations. I have read quite a bit on an elementary level and thought about some more complex issues. I am biased I guess but my brother's (Bill Evjen) chapter on configurations in his Professional ASP.NET 2.0 book covers quite a bit and is quite easy to follow. I am not sure what to investigate next week, so I am taking recommendations. Onward though with day 4 on configurations.

An important portion of your web.config file will consist of the Page Configuration. The page configuration is important  because it will enable you to control some of the default behaviors for each and every .aspx page that is part of your web application. Below is a sample page element.

<pages buffer="[True|False]"
   enableEventValidation="[True|False]"
   enableSessionState="[True|False|ReadOnly]"
   enableViewState="[True|False]"
   enableViewStateMac="[True|False]"
   smartNavigation="[True|False]"
   autoEventWireup="[True|False]"
   pageBaseType="typename, assembly"
   userControlBaseType="typename"
   validateRequest="[True|False]"
   masterPageFile="file path"
   theme="string"
   styleSheetTheme="string"
   maxPageStateFieldLength="number"
   compilationMode="[Always|Auto|Never]"
   pageParserFilterType="string"
   viewStateEncryptionMode="[Always|Auto|Never]"
   maintainScrollPositionOnPostBack="[True|False]"
   asyncTimeout="number"></pages>

By having the page element in your web.config file you are setting up you pages globally in one place instead of using the page directive on each page. You can set up each page in one place and make your changes globally. The attributes that you may find yourself using the most are in bold above.

enableSessionState - Specifics whether the session state for the page should be enabled. Your options are true, false, or ReadOnly.

enableViewState - Allows you to turn on/off your viewstate for all your controls on your aspx pages.

masterPageFile - Specifies which master page you are using for your pages. Be careful how you use this attribute if your application uses more than one masterpage. Some sites us multiple masterpages.

theme - Sets the theme for the pages and you are NOT allowed to overwrite the theme on the individual pages

styleSheetTheme - Sets the theme for the pages and it DOES allow you to overwrite the themes on the individual pages.

posted on Thursday, May 15, 2008 5:03 PM