“Fun” with ASP.Net 2.0 in Mono 1.1.13.4

I tried to get the ASP.Net 2.0 project we’re working on at Synthesys running on Mono. The server runs Debian Linux Etch, and I use the following packages (some of them are preview packages):

  • mono (and related libraries) 1.1.13.4-0pre6
  • mono-xsp2 (and mono-xsp2-base) 1.1.13-1

xsp2 works beautifully, and seems to print out nice debugging information either in the browser on or the server when exceptions are thrown. Unfortunately exceptions are thrown a lot. Here are some of the differences between Microsoft’s and Mono’s ASP.Net 2.0 implementations that I ran into:

  1. Mono does not support Culture="Auto" (or “auto”). Switching to Culture="en-US" works, but isn’t desirable.
  2. CodeFile paths must be absolute from the root of your project. We had a MasterPages folder with a file that specified a CodeFile in the same folder with CodeFile="nameOfCodeFile.cs", but Mono wanted it to be CodeFile="MasterPages/nameOfCodeFile.cs".
  3. Mono seemed to want only integers for measurements in ASP.Net tag attributes that only accept pixel measurements. So “10px” needed to be just “10″. I’m not sure precisely which attributes this applies to as I just changed them all. (I know it does not apply to font sizes.)
  4. Mono 1.1.13 does not contain a definition for Page.Title, only Page.Header.Title. This appears to be fixed in the trunk.
  5. Page.Theme and Page.StyleSheetTheme aren’t supported in 1.1.13, but my new hero, Chris Toshok, just added them.
  6. So far not to bad, but now for the show stopper: my custom SiteMap implementation. A quick glance at Mono’s Class Status page shows SiteMap related classes to be almost done, but I still get the following exception:
    System.NullReferenceException: Object reference not set to an instance of an object
    in <0x0008d> System.Web.SiteMap:Init ()
    in <0x00007> System.Web.SiteMap:get_Provider ()
    in <0x0000a> System.Web.SiteMap:get_CurrentNode ()
    in <0x0000d> MasterPages_default:Page_Load (System.Object sender, System.EventArgs e)
    in (wrapper delegate-invoke) System.MulticastDelegate:invoke_void_object_EventArgs (object,System.EventArgs)
    in <0x00117> System.Web.UI.Control:OnLoad (System.EventArgs e)
    in <0x00112> System.Web.UI.Control:LoadRecursive ()
    in <0x00161> System.Web.UI.Control:LoadRecursive ()
    in <0x001c4> System.Web.UI.Page:InternalProcessRequest ()
    in <0x000a7> System.Web.UI.Page:ProcessRequest (System.Web.HttpContext context)

I have high hopes that the next release of Mono will improve ASP.Net 2.0 support considerably. Hopefully I can start helping submit bug reports and testing new features as well!

This entry was posted in GNU/Linux, Mono/.Net, Open Source. Bookmark the permalink.
  • maoz

    I’m actually having no luck at all getting xsp2 to work, even with a bare minimum aspx+cs page.

    test.aspx:
    ————-

    Test

    test.aspx.cs:
    —————–
    using System;
    using System.Web.UI.WebControls;

    public class Test : System.Web.UI.Page
    {
    }

    Result
    ——–
    Compilation Error
    Error message: /tmp/root-temp-aspnet-0/3034affe/38606.0.cs(25,22) : error CS0260: Missing partial modifier on declaration of type `Test’. Another partial declaration of this type exists

    Any ideas? This is xsp2 v1.1.13.0 (from the mono-1.1.14 linux binary distribution)

  • http://blogs.synthesyssolutions.com/michael/ Michael Schurter

    With codebehind in ASP.NET 2.0, the .cs file needs the new “partial” modifier between “public” and “class”. This is because the .aspx file and .cs file both contains portions of the same class (page object).

    I highly recommend the mono-list mailing list for anyone trying to develop software using Mono. In my experience they’re very helpful whether you’re just learning C# or hacking the JIT compiler.

    http://lists.ximian.com/mailman/listinfo/mono-list

  • http://www.artifexmundi.com Pi

    http://lists.ximian.com/mailman/listinfo/mono-list

    yea… but there is no answers for problems with missings dll files. I supposed, that moving simple asp.net 2.0 apps from VS2005 to mono will be more painless.

  • http://blog.naver.com/okpolis J.P.

    edit /etc/mono/2.0/web.config
    you can enable option, search .

    Have a good day. :-)

  • http://blog.naver.com/okpolis J.P.

    ^^;

    search strings below.

    sitemap enabled=”false”