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 importance of load balancing
- Windows Phone App Studio: an easy way to create your first Windows Phone 8 app
- The end of Windows XP support: what it really means for businesses
- Don't rely on Chrome's password vault
- Using Buffer to manage your social media
- Microsoft needs its own Steve Jobs
- Forget credit cards: hackers want your Facebook account
- Can't get fast enough broadband? Here's what to do
- Leap Motion and the battle against UI stagnation
- How to build a really bad network
- Play it again: Berlin's Computer Game Museum
- Switching from iPhone to Android: what I miss, what I don't
- Tech City: Easy to score when you move the goalposts
- How to remove SkyDrive from the Windows 8.1 Explorer
- Switching from iPhone to Android? Switch off iMessage
- Why is Google pumping more money into Firefox?
- Sky Broadband Shield review
- Samsung Galaxy S4: how to double your battery life
- Motorola Moto G review: first look
- IBM Watson meets Willy Wonka
- Microsoft patches TIFF flaw in next Patch Tuesday
- Microsoft expands encryption over NSA spying "threat"
- UK Cloud Awards 2014: nominations now open
- BlackBerry says "we're still alive" as sales hit new low
- Has HP turned a corner?
- Adobe admits it's struggling to notify hack victims
- Microsoft rolls out Office 365 admin app for mobile
- Office 2013 Service Pack 1 to arrive early next year
- Backup the best defence against CryptoLocker
- UK SMBs can now buy ads on Twitter