EZWeb Beta 0.51 Released on GotDotNet!!!

Go to the EZWeb workspace and download the latest release of my EZWeb application framework.  As I post, 63 people downloaded the first release.  I am pleased that there is interest in this project.  I fixed a bug involving the use of Request.ApplicationPath. 


If I ran EZWeb in a virtual directory, Request.ApplicationPath would return “/ezweb”, but if I ran it as the root web, it would return “/”.  This is inconsistent, so I created a property on my base page called “AppPath” where I correctly determine the path of the application wherever it happens to run.  I used Page.ResolveUrl(”~/”), and this always gives me the correct application path. 


If you don’t already have your own framework for web applications, EZWeb is a great place to start.  If you are just looking for a website that will run itself and will be easy to edit, EZWeb is also for you. 


If you have implemented EZWeb on a public website, send me the URL, so I can check it out!!!

EZWeb Root application bug

In response to comment http://dotnetjunkies.com/WebLog/jpalermo/archive/2004/05/13/13531.aspx#13805:


I have logged one bug regarding the EZWeb Beta 0.5 on the GotDotNet workspace, and it’s relating to the templates that I have included not rendering correcting when running as a root web.  When in a virtual directory, all is well, but when running as root web, the .css and images don’t render correctly.  This is a problem with the sample template that I included.  I will fix the template along with some other things and have another release.  I welcome input and contributions of plugins and templates.  One thing that would be really cool is to make DotNetNuke an EZWeb plugin so any EZWeb user could choose “portal” as part of their site.

Using inheritance with ASP.NET pages


I go back to work full time next Tuesday.  My terminal leave is almost up, I’m a civilian, and my new office furniture will be arriving today. 🙂 


Yesterday I was visiting with two colleagues of mine, and I was struck with a surprising reality:  They were programming with ASP.NET but had no idea that they were using inheritance.  One of the two was a former college professor of mine from whom I learned a great deal of database knowledge.  I pondered on it for a while, and I think that there are probably many out there that don’t yet know how to use the power of inheritance to improve their .Net web applications.  I will now attempt to simply explain an easy way one can easily improve a page using inheritance.


First, when you write code in an ASP.NET page, you are writing code in a class that is inheriting from another class.  Whether it’s specified in the machine.config, web.config or in the <@Page> directive at the top of the page, your page has to inherit from a class that ultimately will inherit from System.Web.UI.Page.  When you use the code-behind or code-beside technique, your page inherits from your code-behind class, which inherits from System.Web.UI.Page.  Look at the class.  Why else do you see “System.Web.UI.Page” in every code-behind page?  It makes your page contain the functionality of the Page class in the .Net framework.  It makes your page a System.Web.UI.Page object.  The Page object contains the properties for accessing Request, Response, Server, Cache, etc. 


Suppose you want to implement tracking for some of your pages?  You could put relevant code in every page, or make a static method in a shared class to track the current request.  But why not put this functionality in a class by itself, say “TrackedPage”.  When you declare TrackedPage, inherit from System.Web.UI.Page:


public class TrackedPage : System.Web.UI.Page{ }


and in your code-behind page, replace the reference to System.Web.UI.Page with “TrackedPage”.  This will make your page a “TrackedPage” object and will benefit from any logic you put in TrackedPage.  For instance,


public class TrackedPage :  System.Web.UI.Page{
protected override void OnInit(EventArgs e)
  {
   base.OnInit(e);
   //logic to track this request
   Trace.Write(“Tracking“, “This request has been tracked.“);
  }
}


will perform your tracking logic and write a line to the trace log for every page that inherits this custom class of yours.  You can imagine all the functionality you can include.  What if you have a custom user object that you need to be available for every request?  Make it a property of your class here, and make it the base page for all your pages? 


I find that a lot of people make user controls to encapsulate common functionality.  This is not a good technique.  Instead, put it in base pages and inherit from them.


My project on GotDotNet makes heavy use of this technique, and it’s easy to extend EZWeb because all you have to do is inherit from Palermo.EZWeb.UIPage, and you have all the functionality available.

GotDotNet Workspace Woes

Yesterday I was very excited to post my first release of my EZWeb project on GotDotNet.


http://workspaces.gotdotnet.com/ezweb


I had applied for a sourceforge.net workspace, but after waiting a week for “approval”, I just wanted it working, so I set it up on GotDotNet.  The workspace pages were slow, but they worked.  Source control was painfully slow, but it worked.  Yesterday evening I noticed that several people had already downloaded my release.  How exciting!!  This morning, I have yet to get to my workspace.  GotDotNet keeps erroring out!!  What gives?  Is anyone else experiencing this?  I can’t even get to the workspace for .Text!

My first public EZWeb release. Version 0.5 Beta

In previous posts, I’ve mentioned EZWeb, my current pet project.  It can be quite useful even if it’s just to make a template for your web apps.  I was surprised that so many people use a header and footer user controls to wrap page content with navigation and common content.  EZWeb will wrap your content with your custom template.  Join my workspace at:


http://workspaces.gotdotnet.com/ezweb
or
http://www.gotdotnet.com/Community/Workspaces/Workspace.aspx?id=949a0c93-38f2-4bd2-9f69-a49bb3c7938d


and contribute some features.  Plugin developers needed.  One of the first priorities should be a file upload plugin.  Please contact me with any questions.  I’m excited about this release, and I hope some of you will be interested in contributing to and using this project.