A working wiki
Posted on 26 Oct 2006 at 11:09
This month, Thomas Lee demonstrates flexwiki, a fully working asp.net application
ASP.NET is a key component of the .NET Framework, which enables you to develop rich, complex websites. ASP.NET is both a programming framework and a runtime environment, and so sites get built upon and exploit the functions in the Common Language Runtime. ASP.NET is also used on servers at runtime, to enable IIS (Internet Information Server) both to serve up the pages and to implement XML Web Services (which I described in last month's column).
In an ASP.NET web application, files containing pages take the extension ASPX (for example, Microsoft's homepage is www.microsoft.com), and such pages may contain both the UI (the HTML that gets rendered in your browser) and the code that implements some or part of the page's functionality. It's best practice for the code to be separated out into a "code-behind" page, with the extension CS (as in default.aspx.cs) for C# code or VB (as in default.aspx.vb) for VB.NET code. The code-behind file specific to any given ASPX file is identified in the latter through the use of the CodeFile attribute in the Page directive.
The screenshot (above right) shows a simple web page being edited in Expression Web Designer that provides a trivial add/subtract calculator; the ASPX page lays out a few controls on the page and then calls out to a separate code-behind file to perform the necessary calculations. In the page directive, the code-behind file is identified as a C# file by its name calc.aspx.cs, and this code is shown in the box overleaf. To deploy the application, you just copy the two files (ASPX and CS) to the website root folder on your local machine - by default, IIS sets this up to be C:\Inetpub\wwwroot - then navigate to http://localhost/calc.aspx in your browser, enter two numbers into the textboxes provided and click a button, as shown in the screenshot below. Your browser sends a request to IIS, noting that a button has been pushed and providing the values you entered. IIS then calls the code-behind, invoking the appropriate method. The code-behind method updates the contents of Label1 with the calculated result, and then IIS returns the page to you, complete with answer.
The calculator example is very simplistic, designed to show only the basics of ASP.NET, and I needed a more complex example to show off the more advanced features. Rather than write lots of code myself, I've chosen a free ASP.NET application called FlexWiki, but before looking at that let's clarify what a Wiki is and how it works. A Wiki is a website whose content can easily be edited by its users using nothing more than a web browser. The term was coined in 1994 by Ward Cunningham to refer both to his website WikiWikiWeb (c2.com) and to the engine that drives it.
The best-known wiki today is Wikipedia (www.wikipedia.org), a free online encyclopedia that anyone can contribute to and edit - it's being written collaboratively, with thousands of changes per hour. This might sound like an invitation to vandalism, but while Wikipedia has certainly had some nasty incidents, each change gets recorded so that any deemed inappropriate can be removed and older content restored. Wikipedia can also block repeat offenders from further editing - a sanction they've had to apply in a few cases.
You add content to a wiki via your web browser, using its software engine and a simple markup language that lets you add bold/italic formatting, headings, tables and images, as well as external references. Most wikis also provide some way to create dynamic content, for example, by scanning all the pages in your wiki and accumulating a list of pages that meet some criterion, such as containing a specific tag.
- Make your mobile battery last longer
- Small steps into handling Big Data
- Nexus 5: does it really run stock Android?
- How to get broadband to a garden office
- How to write your company's IT security policy
- Raspberry Pi and Wolfram: a must-have for every child
- Could you get by with Office Web Apps?
- The best Android antivirus apps for 2014
- Headings vs headers: how to use both in Word
- Windows Server 2012 R2: how the Datacenter edition could change SMBs
- Windows 8.1 Update: an abject surrender
- The insane economics of Sky Now TV
- No such thing as a free app... so pay up if you want quality
- Time to outlaw crapware-laden installers
- Windows Phone 8.1 video: hands-on
- Office for iPad: key information
- Why every PC buyer owes Richard Durkin a debt of gratitude
- HTC One M8 vs Samsung Galaxy S5: 2014's big-hitters compared
- Windows XP end of life: key information
- Cut out the broadband jargon? What jargon?
- Microsoft slashes custom XP support price
- Ubuntu LTS Server 14.04 extends cloud support
- Intel: PC sales are "encouraging"
- Google to rank encrypted pages higher
- Heartbleed: the race to reissue security certificates
- Dropbox boosts app line-up with Carousel and Mailbox for Android
- BlackBerry CEO says not selling off phones "any time soon"
- Microsoft halts business downloads of Windows 8.1 Update
- Raspberry Pi targets business with Compute Module
- Microsoft releases final patches for Windows XP