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.
- How to sell more ebooks on Amazon
- 10 ways to make your business more secure
- Top five VoIP mistakes
- How to add in-app purchasing to an iPhone, Android or Windows app
- Remote-control ransomware: TeamViewer and software hardball
- Why laptops with serial ports matter to the Internet of Things
- 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
- Google Glass: mugger bait, pub problem and other lessons learned from two dangerous weeks
- Twitter, please don't fiddle with my feed
- How Satya Nadella can get some pay-raise karma
- Windows 10: a step back to go forward
- Michael Dell: Cloud infrastructure is the roads, bridges and highways of the 21st century
- How to check your identity hasn’t been sold to the hackers
- Tim Cook: this is how much TV has changed since the 70s
- Westminster wins the .London battle
- 20 years of PC Pro: from deep pan pizza to virtualisation
- Five reasons why the Apple Watch leaves me cold
- Will HP finally split into two companies?
- Chromebooks get version of Photoshop
- Toshiba beats retreat from consumer PC market
- Ellison steps down: but who's really running Oracle now?
- Microsoft set to make more job cuts
- Is Peter Pan panto tickets email genuine? Oh no, it isn't
- Intel triples Xeon E5 chip performance, adds DDR4
- Patch Tuesday targets critical IE flaw
- Microsoft refuses to hand over customer emails
- Microsoft yanks Windows 8.1 update after crash reports