Mono – web development on Linux

It is really easy to get some web c# (csharp) (asp.net) development within a Linux setup, since I use kubuntu which is derived from ubuntu. All you need to do is to

this installs the mono module for the apache2

aptitude install libapache2-mod-mono

to enable the module to work within apache2 you have to update the mods-enabled directory and to do this, just use the

a2enmod mod_mono_auto

which stands for apache2 (a2) enable (en) mod (module) and then the module name, you will need to restart apache2 for it to work

/etc/init.d/apache2 restart

that is it., then if you look within the /etc/apache2/mods-enabled you will notice the

mod_mono_auto.conf
mod_mono_auto.load

of course you could symlink them yourself, but it is just easier to use the a2enmod script.

Within the .conf file it tells apache what extensions to “listen” to direct to the module mono instead of either php module or just a static html web page.

To test the setup, just create a directory within your hosting directory this is normally /var/www/ or just place a file in that base directory /var/www it is up to you, but within that file you could create a basic test file like.

<%@ Page Language="C#" %>
<html>
  <head>
    <title>Apache2 Mod mono test page</title>
  </head>
  <body>
        <form id="form1" runat="server">
          <asp:label id="lbl1" runat="server">Apache2 Mod mono test page</asp:label>
        </form>
  </body>
</html>

the asp:label will be the main test, since that part of the csharp library as such. you should see something like

Apache2 Mod mono test page