Testing on Linux, Windows
A single "Run" button click in Visual Studio compiles the code, copies everything to the proper virtual directory, and loads the ASP.NET page into a browser. VS compiles the server-side C# code into a
.dll file and places that in a directory named
bin below the application root. Visual Studio provides full debugging support including the ability to set breakpoints, examine variables, and step through code.
Testing the application on the Linux side couldn't be easier. The simplest way to move the application over from Windows is to first copy the entire application virtual directory over to a shared drive. Then, from the Linux box, connect to the shared drive and copy the files to a working directory. On Linux, I created a directory named
ASP in my
Home directory and copied the files there. Then from a terminal window start up the XSP server with the command:
mono /usr/bin/xsp.exe
That command launches the Mono Web server application, listening on the default port of 8080. To view the application you launch a browser and browse to the URL for your local server and the appropriate path and page, for example:
http://localhost:8080/FamilyCalendar.aspx
 | |
| Figure 2. The Family Calendar Application on Mono: As you can see, the application looks essentially identical when compiled and run with Mono. |
The most amazing part of the entire process is the fact that you
don't have to recompile anything. It just works! Well, almost works. While I wasn't able to get the app to work exactly as I wantedthe LinkButton for the day number doesn't appear in the current date cell of the calendar, so you can't click to make the event details display for the current dayeverything else works (see
Figure 2). That single difference is apparently a bug in the calendar control. I could still make the details DataGrid show up by using a JavaScript URL that causes a postback, sending the value that the LinkButton would normally send to the server (see the URL shown in
Figure 2). After reporting the issue to the Mono developers list I was instructed to file a bug report. Hopefully this will be fixed in a future release. One temporary workaround would be to show the actual events only in the DataGrid and not in the calendar. Other than this minor and probably temporary glitch, the degree of compatibility is extremely high. I made no changes to the code to run it on both platforms.
Giant Steps
Building cross-platform ASP.NET applications has taken a giant step forward with the release of Mono version 1.0. While it's not (yet) one hundred percent compatible, it's certainly close. Future releases of Mono will add increased VB.NET support along with a host of other features. For more information on the direction of Mono, explore
the Mono Website and check out the
roadmap.
Mono makes it possible for companies or departments looking to implement a Web-based application using ASP.NET on non-Microsoft platforms. What's missing at the moment for full development on Linux is a good competitor to Microsoft's Visual Studio product.
MonoDevelop is a port of the open source Windows-based
SharpDevelop project. In its current release it does not have a graphical user interface designer, but the project developers plan to add one in the future. Until that happens though, if you have access to Visual Studio, you can use the VS designer to design your Web Forms, and then simply copy the code to your Mono project.