Friday, October 17, 2008

Mono XSP: Open Source ASP.NET Development

ASP.NET is traditionally a Microsoft domain; but not now - now any PC can run ASP.NET by installing Mono XSP.

ASP is now considered very much 'last century' and has generally been superceded by ASP.NET - both of which have been produced by Microsoft; and that, of course, is the one fact that may deter some web site developers from using it (especially if they come from a Linux background). However, that is no longer an issue - thanks to the Mono's XSP.

What is Mono?

Mono is an open source implementation of ASP.NET which fully supports ASP.NET version 1.1 and most of ASP.NET version 2.0.

What is XSP?

XSP is a standalone lightweight web server designed specifically to support Mono.

Installing Mono and XSP

Installation of both Mono and XSP is very easy:

the binaries (for both Windows and Linux) are available from the download section of the Mono web site (http://www.mono-project.com)
many of the Linux distributions have their own versions of both Mono and XSP, for example with Debian Linux it's just a matter of using the apt-get command to install the software:
sudo apt-get install mono
sudo apt-get install mono-xsp
Once the software has been installed then the developer will need to create a new directory - this will become the home directory for the XSP web server:

cd
mkdir mono
Next the server will need to be started from the new directory:

cd mono
xsp
At this point the user will receive confirmation that the XSP web server is running:

Listening on port: 8080 (non-secure)
Listening on address: 0.0.0.0
Root directory: /home/bainm/mono
Hit Return to stop the server.
The XSP web server will now be up and running

A Simple Example of an ASP.NET Web Page

The XSP web server is almost ready for use, however it still needs an index page, something simple like:

<%@ Page Language="C#" %>


<%
Response.Output.Write("Greetings from the XSP Web Server");
%>


This first web page must be named index.aspx and must also be placed in the XSP home directory (the one in which the xsp command was run).

Accessing the XSP Web Server

Once the index.aspx is in place the server can be accessed via the default port 8080 - so the next stage is to open up a web browser and type in the correct url:

http://:8080/
Changing the Home Directory and Default Port

It is, of course, not always convient to start XSP from the current directory or to use the default port - if that's the case then they can both be defined when starting the server:

Conclusion

By installing the Mono XSP server anyone with a computer, be it Linux or Windows, can start developing their own ASP.NET applications, or even just learning how to use this powerful and adaptable software.

0 comments: