Create and Run ASP.NET Applications on Linux using Mono

Savia Mendes Absent Member.
Absent Member.
0 0 12.2K


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.

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.