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">   
</asp:ContentPlaceHolder>

 

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"
    runat="server">
</asp:Content>

 

Content Page:

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

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
   runat="server">
</asp:Content>

 



How to Install VSeWSS 1.3

by agrace 27. January 2009 16:40

Download the 1.3 extensions to your C:/ drive from here:

https://connect.microsoft.com/Downloads/Downloads.aspx?SiteID=428

Start the msi from an elevated command prompt - that is, right click Command Prompt icon in Start menu and select 'Run as Administrator'. Issue this command:

C:\msiexec /i VSeWSSv13_x86_Build_307_CTP.msi

This will prevent the UAC from causing the VSeWSS 1.3 to "fail prematurely".

Update 02-19-20009:

sn.exe meant for 32-bit OS runs without error on 64-bit OS and incorrectly shows message indicating success.

Update 03-31-2009:

Latest release is a .exe file, so this shouldn't cause problems.



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 :-)

Tags:

ASP.NET