Create and run ASP.NET applications on Linux using Mono.


What is Mono?

Mono provides the necessary software to develop and run .NET client and server applications on Linux. It can also be deployed on Solaris, Mac OS X, Windows, and Unix. Mono is dual licensed by Novell, similar to other products such as Qt and the Mozilla Application Suite. Sponsored by Novell, the Mono open source project has an active and enthusiastic contributing community and is positioned to become the leading choice for development of Linux applications.

Some Features

  • Multi-platform
  • Based on the ECMA/ISO standards
  • Runs ASP.NET and Winforms applications
  • Can run .NET, Java, Python and more
  • Open Source, Free Software

Now we come to the main essence of this article, i.e running ASP.NET applications on Linux.

This article assumes that Mono is installed on your Linux system. If it is not installed you can download from

Now, lets get started building our first ASP.NET Application using Mono XSP

First of all let’s create a folder or directory to store the ASP.NET files and change to that directory. You can create the directory in your home directory.

Type in the following commands at prompt to do the same

mkdir aspdotnet 

Will create a directory aspdotnet

cd aspnet 

Will change to directory aspdotnet

Now we will create a simple application that will display a message on click of a button to greet a user who has entered his name in the given text box.

For this we will create a ASP.NET page

Type in the following code in greet.aspx using your choice of Editor (e.g. vi greet.aspx)

Begin of code greet.aspx
<%@ Page language="c#" src="greet.aspx.cs"
Inherits="GreetApp.GreetPage" AutoEventWireup="true" %>
<title>ASP.NET on Linux</title>
<form  runat="server">
  Enter your name: <asp:TextBox id="name" runat="server" />
  <asp:Button id="greet" Text="Greet" onClick="OnGreetClick" runat="server"/>
<br /><strong><asp:Label id="message" runat="server">Mono Power
End of code greet.aspx

Type in the following code in greet.aspx using your choice of Editor (e.g. vi greet.aspx.cs)

Begin of code greet.aspx.cs
using System;
using System.Web.UI.WebControls;
namespace GreetApp
   public class GreetPage : System.Web.UI.Page
  protected Label message;
  protected Button greet;
  protected TextBox name;
  public void OnGreetClick(Object sender, EventArgs e)
  message.Text = "Congratulations, " + name.Text + "You are running ASP.NET On Linux ";
End of code greet.aspx

After saving the above files, type xsp at the command prompt to start the Server.


Now open a web browser, type the url http://localhost:8080/greet.aspx and press ENTER. You should see a web page with a text box and a message. Enter a name in the text box and click the “Greet” button.

Welcome to the world of Mono.

0 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 5 (0 votes, average: 0.00 out of 5)
You need to be a registered member to rate this post.

Disclaimer: As with everything else at NetIQ Cool Solutions, this content is definitely not supported by NetIQ, so Customer Support will not be able to help you if it has any adverse effect on your environment.  It just worked for at least one person, and perhaps it will be useful for you too.  Be sure to test in a non-production environment.

Leave a Reply

No Comments
Jan 2, 2007
11:01 am
Active Directory Authentication Automation Cloud Computing Cloud Security Configuration Customizing Data Breach DirXML Drivers End User Management Identity Manager Importing-Exporting / ICE/ LDIF Intelligent Workload Management IT Security Knowledge Depot LDAP Monitoring Open Enterprise Server Passwords Reporting Secure Access Supported Troubleshooting Workflow