You may find following snippet very handy in situations where you want to incorporate a base page in a project that uses a master page. From an architectural point of view, implementing a base page is something you should always consider. If you need to implement something in your content pages at a later stage, you only need to do it once, in your base page class. Personally I use it to add meta content and description tags to each content page in my "Web Application Project" site - think SEO!

Refer to Jim Azar's great article for the base page code for adding the meta tags. Note also that you can add your own tags to the the Page attribute of your base class.

In the Page tag of your content page, pay particular attention to the use of the CodeFileBaseClass attribute as this is used to access the public properties of your base page class. This, along with the CodeFile tag, are the new additions to the Page tag for this particular scenario - if you were not using a base page, you wouldn't have these two attributes; instead, you would just have the usual CodeBehind tag.

Master Page:

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="MyProject.master.cs"
    Inherits="MyProject.MasterPages.MyProject" %>

<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">   


Base Page:

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/MyProject.Master"
    AutoEventWireup="true" CodeBehind="BasePage.aspx.cs"
        Inherits="MyProject.BasePage" %>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"


Content Page:

<%@ Page Title="MyProject - Home" Language="C#"
    MasterPageFile="~/MasterPages/MyProject.Master" AutoEventWireup="true"
        CodeFileBaseClass="MyProject.BasePage" CodeFile="Default.aspx.cs"
                Meta_Description="Code Snippet: Master Page and Base Page"
                    Meta_Keywords="master, base, content" Theme="Style" %>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"


Oxite - The Autopsy

by agrace 20. December 2008 09:09

Nerd Bitch Yeah, I know, the title is controversial, but then again, so is Oxite. Ditto for MVC. Remember the hype about Java? Here we go again... just because there is a need to improve our development process in the shape of some practical test-driven way, does not mean that the first thing we come up with is going to provide the answer to everyone. No RAD shop was ever going to be able to adopt text book TDD, and the same goes for MVC. No-brainer.

There has been a huge whole in the market over the last few years for a small to medium-sized CMS tool. With all the hype surrounding ASP.NET MVC right now - just look at the amount of attention devoted to MVC right now on the ASP.NET home page - the announcement on CodePlex of a new ASP.NET MVC CMS system was sure to arouse huge interest. The unfortunate mention of the word "Microsoft" in the blurb has resulted in an unbelievable amount of venom in the blogosphere directed at the developers of Oxite. Despite this post's title, I'm not going to perform an in-depth autopsy on Oxite. The guys who developed this have done what a lot us haven't: they have given openly to the community and the pony-tails have come out bitching as usual. There's probably less bitchiness in the world of fashion design than in the world of open source :-O

One of the more constuctive pieces of feedback I have seen came from Rob Connery, who actually pitched in and offered to help. Instead of slamming the people trying to contribute, he offered constructive advice on how to make it better. Kudos. Karl Seguin, was a little more heavy handed in his critique and that sparked off some interesting feedback in the comments section. FYI, I'm not criticizing Karl whose blog is one of my favorites. The reason I'm not, is because I often jump in there and say stuff in the heat of the moment which inevitably lands me in it. My mouth and by extension, my fingers, have always been a few steps ahead of discretion.

Sobriety Checkpoint Long before ASP.NET MVC came out I had been watching Microsoft stagger inch by inch like a drunken man reaching for the whiskey bottle, in the direction of both the open source community and open standards in general. It's like, at some point, a light went on at Redmond: "Jaysus, maybe we should start paying attention to these open source dudes with the pony tails." Developers were moving away from Microsoft despite the superiority of the framework, the languages and the tools. I remember several years ago meeting one of the Microsoft managers at a Microsoft event in SF, and having a general conversation about Microsoft's tools - this was before Web Express - and I remarked that since Java was then the de facto language in colleges and that the IDE was free, that Microsoft would be out of the development business within five years if it didn't wake up. I can still see his face. Priceless.

This is all old hat news at this stage, but we all know the Microsoft has accepted that it has to conform to standards and has to move in the direction of the larger developer community. No longer will the tail wag the dog. Maybe the arrival of Ray Ozzie provided the required impetus, who knows. The move to an MVC version of ASP.NET was a marketing master-stroke but one that may come back to bite Microsoft on its ass if the hype exceeds the promise.

As for Oxite, I'm sure that it will mature into something very useful. There is still a need for a free ASP.NET Web Forms version of a CMS system and hopefully something like that will appear soon. In the meantime, this is the Season of Giving. As a community, we should all think bigger, dream bigger and maybe come up with new means of collaboration and "what if" scenarios for the future. Community online think tanks? Maybe bring in professionals from some of the other verticals such as doctors... develop something meaningful rather than more mental masturbation in the shape of software tools to build more software tools? Just thinking out loud and drinking too much espresso :-)



Microsoft Releases Free CMS System Now I know it's Christmas! I just read on Mary-Jo Foley's blog about the new, free CMS/Blog system released by Microsoft called "Oxite". It is built using the new ASP.NET MVC framework and is highly extensible, touting such features as Microformats and source control integration. In fact, it is so customizable that users can swap out Microsoft technologies and use search and database providers of their choice. In addition, it can be used with different source control products such as TFS or SVN.

The Oxite team who were responsible for Channel 9, have put considerable effort into establishing a strong base that developers can both use off the bat, as well as extend themselves. I'm itching to give this a test drive but am somewhat nervous of the beta-state of MVC right now. So, I'm treading carefully before attempting the full install. It might be worth the time spent to read the MVC release notes and Phil Haacks account of some installation issues before jumping in head first.

You can run Oxite on any version of XP, W2K3 or W2K8. You only need three pieces of software: some version of Visual Studio or Express, ASP.NET MVC and either SQL Express 2005 or 2008 - I'm guessing that SQL Server 2005 will work as well? Note that the online installation instructions for full version VS and database have not at the time of writing, been added. Like that's going to stop us, right?

You can create single blog or multi-blog sites. You can create your own pages and sub-pages, etc. It's got pingbacks, trackbacks, multi-level RSS feeds, gravatars... the list goes on. Plus, we get to use Live Writer to post to our blog :-)

The only thing about all this is that I no longer have an excuse not to learn the MVC framework. So, I guess I better head over to the ASP.NET site and educate myself...

Tags: ,

ASP.NET | Blog