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.
- The ICO's shame-faced u-turn on cookies
- Start8 and ModernMix: making Windows 8 work on a desktop
- How to boost your mobile reception
- How to fix Facebook: Social Fixer
- Taking the stress out of WordPress updates
- Where to download free web fonts
- Turn your tablet into a Sky+ remote control
- How to measure the success of a new IT system
- Three years on: the state of the tablet market
- Windows 8: what works and what doesn't
- Flickr redesign: is it enough to tempt photographers back?
- Hands on with the new Google Maps
- Nokia Lumia 925 review: first look
- Why I won't subscribe to Creative Cloud
- GoPro camera strapped to a remote-control helicopter: the ultimate boy's toy
- Acer Iconia A1 review: first look
- Acer Aspire P3 review: first look
- Acer Aspire R7 review: first look
- How we produce the PC Pro podcast
- Google Now draining iPhone battery
- IBM's Watson answers customers' questions
- New CEO reorganises Intel to target "new devices"
- Dell profits slide 79% amid buyout talks
- Forget cloud subscriptions: users prefer standard licences
- McAfee: cloud storage could help spread viruses
- Analysts question Windows 8 as UK PC shipments slump
- Google pools storage across Gmail and Drive
- Ofcom accused of killing off VoIP competition
- ShoreTel dock turns iPhones and iPads into desk phones
- Bill Gates says iPad users "frustrated"