Serving SSL from localhost on IIS 5 on Windows XP using Self-Signed certificates

I’ve probably glossed past this a few times, but it turns out getting SSL working on your dev machine is less painful than you’d think…

  1. install iis60rkt.exe from http://www.microsoft.com/downloads/details.aspx?FamilyID=56fc92ee-a71a-4c73-b628-ade629c89499&DisplayLang=en on your local machine. It’s intended for IIS 6.0 but it works
    in IIS 5.1.
  2. Select custom install if you only want to use SelfSSL.
    Otherwise, install all.
    There’s a lot of other useful stuff there.
  3. Select Programs –> IIS Resources –> SelfSSL –> SelfSSL
    command prompt
  4. In the command prompt, you’ll see a list of all possible
    command parameters..
    1. Type ‘selfssl.exe
      /V:60’     This indicates the certificate is valid for 60 days
    2. Type Y to answer the
      question “Do you want to replace the SSL settings for site 1 (default website)
      ?
    3. Type ‘iisreset’ to
      restart IIS.

If your browser prompts something like ‘Certification Authority not recognised’ (in Firefox), just put the url in the exception list or override the warnings when viewing the page.


Thanks to Ricky for getting this info together.

More reasons to love JQuery

I’ve only recently started using JQuery, but needless to say – it rocks!

for those that don’t know it’s a Javascript library that’s basically revolutionising how you write client-side code.  My reasons to love JQuery.

  1. It’s open source, well tested and an open design.  This means you write less code and you can rely on functionality just ‘working’ in different browsers – or gracefully failing if something’s not right.
  2. It’s really light (especially when ‘packed’ – 31kb)
  3. It’s got a strong community with lots of really cool plugins (just take a look before you start developing that ‘widget’ in flash)
  4. It plays well with other libraries and code.  you just use it for what you need and plugins sit with other plugins.
  5. It’s obviously gaining momentum, as Scott Hansleman announced Microsoft are going to ship it with ASP.NET MVC and Visual Studio (that’s a pretty amazing move from Microsoft).

If you’re just getting started with it, and you’re familiar with Javascript already I’d start with the tutorials.  Some are better than others, but run through the first couple to understand how it works, then scan down the list to find something related to what you need to do.  Typically you’ll be wanting to write a plugin, so I found this one quite good for starters.

You should find everything you need in the Documentation

you’ll then spend most of your time in the API section, looking for specifics on how to do things. 

Using CSS Frameworks to do the heavy layout lifting

CSS is great, until you’re faced with a deadline and a broken IE6 layout.  You get the cowboy gear out and – ‘Welcome to Hacksville!’  


There’s been a growing trend of CSS frameworks recently as people are obviously crying out for ‘something’ to save them from the madness. 


I’m trying out the 960 grid system at the moment, as it’s not too prescriptive and gives me the flexibility I need.


There’s a great review of the best frameworks on adactio.  I’m sure there’s one to suit almost every need.  Remember they’re just the starting point if you’re doing serious design, but they’ll take most of the pain away, because the heavy ‘hack’ lifting is done for you…   


Also – more on Wikipedia (Update: 17/09) – BlueTrip’s the way to go – best of several worlds – nice.

Who needs Internet Explorer when you can use it in Firefox?

I love Firefox and its addons, although I still habitually use Internet Explorer.  IE6 at work (which always provides some nice CSS challenges!) and IE7 at home.


I’m a bit slow off the mark with using firefox, but the latest addon that someone sent me yesterday may have tipped the balance.


The IE Tab addon actually uses the IE rendering engine to render in a new tab in Firefox.  It’s quite amusing when you right-click and get the IE context menu.


The really great thing about this is that you can then use the power of the other Firefox addons to develop for IE.  Here’s my list of ‘must haves’.



  • Firebug.  This is quite simply the best addon.  Hit F12 and you can instantly see (and manipulate) all sorts of things in the comfort of your own browser.
  • YSlow.  Great Javascript profiler
  • FireCookie. See and change your cookies (for development purposes of course! – Good to test the security of your apps)
  • Web Developer.  Bit of overlap with Firebug but some cool features.

The IE Developer Toolbar is still a pretty good tool, but Firebug just gives you more info when you’re debugging CSS (which is inevitable with IE).


 

Installing Multiple versions of Internet Explorer with Multiple_IE

I don’t have the time, inclination or grunty machines to play around with Virtual machines just so I can test a website in IE6 (after IE7 ‘magically’ appeared).  When I say ‘test’, I actually mean hack an IE-specific CSS together with some box-model workarounds.  I digress…


Enter Multiple_IE.  It’s not perfect (it’s a hack in itself), but it suffices in most cases so kudos for that…  You even get the nostalgia of IE3

When is XHTML not XHTML?

Well you may think it’s just a matter of rendering some well-formed markup and setting your doctype…


<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>


right?  Wrong!


Different browsers render in different ways.  What’s common however is that unless your response’s content type is “application/xhtml+xml” then you may not pass go and pick up $200.  You can force the browser to recognise the content type in two ways (in addition to the DOCTYPE declaration above):



  1. Name your file with an .xhtml extension (not really a solution as IE says ‘what?’)
  2. Set Response.ContentType = “application/xhtml+xml” (See here for more info)

The DOCTYPE is really an additional information item and not something modern browsers do much with on its own.  So how different are the browsers’  XHTML implementations?


Internet Explorer for instance takes the ‘all comers’ approach and will do the best it can given the markup, whilst degrading gracefully if it encounters errors.  great! I hear you say – saves me from actually testing this thing!


Firefox on the other hand will use a completely different parser once it knows you want to serve well-formed markup.  The good thing about this is that you immediately see any errors and the page won’t render if there’s invalid markup.  IE meanwhile continues to let you believe you’re an XHTML master (note: it doesn’t recognise the xhtml extension).



Firefox has some good resources about supported features.  A common one that catches people out is Javascript’s document.write.  This isn’t allowed in XHTML as the string input can’t be guaranteed to be valid XML. 


Safari’s not quite as advanced yet as Firefox’s support, but it too will properly validate your markup and report errors.


If you really want to stick your neck out then place a link on your site to validate against the W3C’s standards.  You’re likely to get plenty of errors – like this page!


Other things to watch out for are Content Management systems that allow you to enter non-compliant html in text editors, and simply not having JavaScript blocks in CDATA sections).


 

The best gmail Google Gadget

When I say ‘best’ – I mean one that allows you to use gmail where you’d otherwise be blocked.  This does everything within the one window rather than opening up gmail (and alerting the company web police).  This requires a bit of real estate so you might want to create another iGoogle tab with one column.


I can probably uninstall Gmail lite from my home box now…


Here it is


 

ASP.NET Extender Control for Expiring Content

I recently had a specific requirement to ‘expire’ some content on a web site.  There’s a million ways to do this, but my previous use of ExtenderControl in Windows Forms development sparked my interest when I noticed the Ajax toolkit supports this (mainly for client-side functionality). 


After downloading System.Web.Extensions, and about half an hour later I’d got the ‘ExpiringExtender’ Control that can be added to your ASP.NET (2.0+) page to allow content to phase in or out. 


The only down side to this approach is that your source code becomes littered with expired code like the Earth’s orbit does with old satellites!  This was therefore a quick solution to a specific problem – not an approach I’d advocate if this is a core requirement (you need a good Content Management System with built-in scheduling).


Anyway – here’s the class (chuck it into your App_Code folder if you’re using a Web Site project – as in my example).  The code’s pretty simple – just set a couple of properties (defaulting to min and max dates if not supplied) and the control’s visible property gets set appropriately.


using System;
using 
System.Web;
using 
System.Web.UI;
using 
System.Web.UI.WebControls;


namespace 
CodeBureau.WebControls
{


    
/// <summary>
    /// This control works as a simple Extender to any server or html control to allow crude time-based 
    /// show-hide functionality.  NOTE This requires the Ajax Toolkit.
    /// </summary>
    
[TargetControlType(typeof(Control))]
    
public class ExpiringExtender : ExtenderControl
    {

        
#region Private Attributes

        
private DateTime showFrom DateTime.MinValue;
        private 
DateTime showTo DateTime.MaxValue;

        #endregion

        #region
 Public Attributes

        
/// <summary>
        /// Gets or sets the show from date.  This indicates that the control should be visible from this date/time
        /// </summary>
        /// <value>The show from.</value>
        
public DateTime ShowFrom
        {
            
get return this.showFrom}
            
set this.showFrom = value; }
        }

        
/// <summary>
        /// Gets or sets the show to date.  This indicates that the control should be visible to this date/time
        /// </summary>
        /// <value>The show to.</value>
        
public DateTime ShowTo
        {
            
get return this.showTo}
            
set this.showTo = value; }
        }

        
#endregion

        #region
 Event Handlers

        
/// <summary>
        /// Raises the <see cref=”E:PreRender”/> event.
        /// </summary>
        /// <param name=”e”>The <see cref=”System.EventArgs”/> instance containing the event data.</param>
        
protected override void OnPreRender(EventArgs e)
        {
            
base.OnPreRender(e);

            
Control control FindControl(this.Page, this.TargetControlID);
            if 
(control != null)
            {
                DateTime now 
DateTime.Now;
                if 
(now < showFrom || now > showTo)
                {
                    control.Visible 
= false;
                
}
            }

        }

        
#endregion        

        
/// <summary>
        /// Gets the script descriptors.
        /// </summary>
        /// <param name=”targetControl”>The target control.</param>
        /// <returns></returns>
        
protected override System.Collections.Generic.IEnumerable<ScriptDescriptor> GetScriptDescriptors(Control targetControl)
        {
            
return null;
        
}

        
/// <summary>
        /// Gets the script references.
        /// </summary>
        /// <returns></returns>
        
protected override System.Collections.Generic.IEnumerable<ScriptReference> GetScriptReferences()
        {
            
return null;
        
}

        
/// <summary>
        /// Finds the given control (recursively).
        /// </summary>
        /// <param name=”parent”>The parent.</param>
        /// <param name=”id”>The id.</param>
        /// <returns>the control if found (else null)</returns>
        
private Control FindControl(Control parent, string id)
        {
            Control recurse
;
            if 
(parent.ID == id)
            {
                
return parent;
            
}

            
foreach (Control child in parent.Controls)
            {
                recurse 
FindControl(child, id);
                if 
(recurse != null)
                {
                    
return recurse;
                
}
            }
            
return null;
        
}

    }

}




Colorized by: CarlosAg.CodeColorizer


And to use it in a page (I’ve got it within a master page here) you just add the registration for the extender control (note the Assembly=”App_Code” – I had to google for a while to find that.


You also have to add the ScriptManager control (an Ajax requirement), then just make sure the content you want to phase in or out has runat=”server” (it should work for HTML or Server controls).


<%@ Register Assembly=”App_Code” Namespace=”Coles.WebControls”  TagPrefix=”uc1″ %>


<asp:Content ID=”Content2″ ContentPlaceHolderID=”body” Runat=”Server”>
<asp:ScriptManager id=”ScriptManager1″ runat=”server”></asp:ScriptManager>
    
<uc1:ExpiringExtender runat=”server” ID=”a” TargetControlID=”header” ShowTo=”13 March 2008 16:15:00″></uc1:ExpiringExtender>

<h1 id=”header” runat=”server”>Hey – I turn into a pumpkin at 4:15…</h1>



Colorized by: CarlosAg.CodeColorizer

ASP.NET Open Source Content Management Systems

I’m producing a site for a client at the moment, and it quickly became apparent that I’d have a number requirements that would lead me down the CMS path:



  1. Client makes direct updates to the site (with approval/preview possibilities if possible)
  2. Built-in membership, security, roles etc (why write this yourself? – I’ve got 2 kids and just don’t have the time or inclination!)
  3. Skinning capability (OK ASP.NET gives you that ‘kindof’ for free – but I throw it in anyway)
  4. CSS-driven layout (rather than tables) – This is a technical requirement for me rather than the client, but I want to make the site accessible and SEO-friendly
  5. Capability to customise  and add generic hooks to other office-based systems
  6. Quick time to market (building all the above from scratch would be ‘fun’ I’m sure, but would also take time)

To be fair to the customer I couldn’t really suggest that I do everything from scratch when there’s plenty of open source and commercial CMS’s that can do the job very well. 


I do .NET – so I’m sure there’s plenty of great CMS’s for other platforms, but I’m not about to use this as a re-skilling exercise, charging a customer for the pleasure (as I need to do some more ‘significant’ development around the site, so will be using .NET for that).


What follows is a personal view based on my requirements and my experience (rather than extensive research into each product).


DotNetNuke


This was the first one I considered as I’d had dealings with it a few years ago (a dev ‘community’ site at a previous employer).  After playing with just about every module on the planet at the time (‘cos you do), we realised we just needed a blog, so converted to Community Server as that seemed a bit less cluttered.  (BTW if you want to run .NET blog without SQL Server (like me) then DasBlog’s what you want.


Pro’s



  • Price (free)
  • Supports pretty much everything I need (open architecture, skinning, module development etc)
  • Familiar from previous use
  • Easy to use and administer – very WYSIWYG
  • Documentation’s comprehensive (if a little focused towards the high-level architectural view). 

Con’s



  • Slow (I thought I imagined this as my own dev machine’s not a ‘beast’ and it’s running SQL 2005 express, but part of this is potentially partly due to the caching mechanism (as noted on the MojoPortal site)
  • Table-driven by default (if you want your skin to be CSS-driven you’ve either got to muck around for ages finding a ‘good’ CSS skin (there’s plenty of bad/really basic ones).  This extends to the DNN standard controls, and it takes an awfully long time (using Firebug and the IE Dev toolbar) to work out why you’ve still got fixed size fonts when you’ve gone to great length in your skin to make everything sizable.  (I’m sure again the better CSS skins address this, but you there always appears to be something that gets in the way because the original DD design uses tabular layout throughout).
  • It’s written in VB.NET (OK this isn’t a ‘real’ reason, as there’s no difference – I know!  You also shouldn’t need to do much (if anything) in VB.NET if you’re a C#’er and you want to extend things – I think I’m just a bit miffed I’ve got to work with a bit of VB.NET at work at the moment 🙂 )
  • Not that keen on the actual logical structure, and the limited url-rewriting.  The whole anonymous tab thing out of the box.  It seems to me that DNN was designed before lots of newer features became available and it’s had to bolt them on as time’s gone by.
  • Lastly – it doesn’t feel very open source.  It’s clear that the business model has evolved to keep the output freely available whilst making money out of books, consulting and conferences (fair play to Shaun Walker – he deserves the kudos for the product).  I just feel that things went a little ‘corporate’ a while ago, which turned me off.  I bought an iRiver rather than an iPod for the same reason (too much marketing noise that turned me off, almost trying to bombard you so you don’t even consider other products, and also trying to deter competition).  There’s also many people now trying to make money out of skins (most of which aren’t terribly good) – another indicator that the ‘community’ isn’t very focused on open source development.

MojoPortal


Until a couple of days ago I’d not heard of this, but the performance discussion (above) sparked my interest.  It’s clearly got less out-of-the-box functionality and community support than DNN and is lacking more in the documentation department, but if you’re after a no fuss implementation then this might be the way to go.


Pro’s (from the site – not my experience)



  • Free and open source
  • Multi DB support (just about any DB you’d care to use)
  • Approval/workflow support (although haven’t looked into this yet)
  • Provides major functionality required
  • Skinning uses standard ASP.NET theme-based approach
  • Aligned relatively well with accessibility guidelines (CSS layout) – XHTML compliancy 

Con’s



  • Download is actually a little confusing.  You’ve got a number of zip files and you’re left to work out which one/s you need.  I downloaded a couple then reaslied I only needed the mssql release. 
  • Documentation a little lacking (although installation pretty easy once you’ve just changed a config setting). 
  • More of a ‘developer’ product – some understanding of .NET required.  This makes it more difficult for non-techy people to get it off the ground  

Jury’s still out on this one as I’ve literally installed and that’s it.  I need to get to grips with the integration and skinning support, as I want to change the default 3 pane layout and remove the left panel, so we’ll see how that goes…


Others (That I don’t know anything about)


Rainbow Portal (looks like it might be more worth a look in a year or two when there’s a bit more support


Umbraco (not all versions free)


 


So what am I going to do now?  Install MojoPortal and see if it ‘feels’ nicer than DotNetNuke.  I’m not really too worried about future support, and upgrades as I’m providing a site to a client who will run with it once I’m done (based on what it does ‘now’ – and how stable it is ‘now’).


I’ll post the results – or add to the list when I’ve come to a conclusion after some more research