Online Help for Web Applications

I developed a system to provide online help for users of an ASP.Net application. The content of the documentation is stored in a Mediawiki wiki.

Creating the help system consists of 4 steps:

  1. Setting up the wiki
  2. Linking the web application to the wiki
  3. Creating content stubs for each ASP.Net page
  4. Editing the content

From a developer’s point of view, steps 2 and 3 are the most interesting.

Setting up the wiki

As I chose to have the online help in a separate namespace, it has to be registered in the LocalSettings.php:

# > 100, even = content namespace
$wgExtraNamespaces[100] = "OnlineHelp";    
$wgContentNamespaces[] = 100;

Linking to the wiki

My ASP.Net 1.1 applications were frame-based, but as version 2.0 introduced Masterpages, developers are encouraged to use them.

The advantage of Masterpages is that they share layout and functionality with the embedded aspx pages, and every page has a unique URL (as opposed to a frame-based solution).

Therefore the simplest way is to add a “Help” HyperLink to the masterpage, and set the link’s NavigateUrl to point to the wiki entry in the Page_Load event:

    protected void SetupHelp(HyperLink hlHelp)
    {
        if (!IsPostBack && !Page.IsAsync)
        {
            string s = Request.
               AppRelativeCurrentExecutionFilePath.Substring(2);
            hlHelp.NavigateUrl = GetWikiUrl() + 
               s.Split('.')[0].Replace('_', '-');
            hlHelp.Visible = true;
        }
    }

This procedure retrieves the name of the current page (cutting off the leading “~/” and trailing “.aspx” plus query parameters), and adds the wiki’s base url. (I also chose to replace underscores by dashes, too).

Creating content stubs

To create wiki content, I developed a wikibot which posts pages into the wiki.

A command shell script iterates through all .aspx pages, and posts the contents of a pre-defined text file into the wiki, using the page’s name as the title (as required by the C# code above).

Additionally the script also generates an index page which links to all page entries in the wiki.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.