[Mono-list] Re: CodeBehind tag from VS.NET

Robert Jordan robertj at gmx.net
Wed Jul 6 02:52:35 EDT 2005


Gavin,

> Hi - I'm a little curious on this one... Microsoft VS.NET generates .aspx 
> pages whose first line is similar to:
> 
> <%@ Page language="c#" Codebehind="WebForm1.aspx.cs" 
> AutoEventWireup="false" .....
> 
> If I try to run this directly with mod_mono and Apache, I'll get a scary big 
> error:
> 
> Error message: Cannot find type WebApplication1.WebForm1
> 
> Yet if I simply change the keyword 'Codebehind' to 'src', the application runs 
> perfectly.
> 
>  http://www.mono-project.com/FAQ:_ASP.NET#Does_Mono_support_code-behind_in_ASP.NET.3
> 
> This FAQ says : "That [Codebehind] attribute is ignored by MS and Mono parsing 
> code" - then why does the app run on IIS but not on Mono, if both 
> environments ignore the tag?

Because Visual Studio compiles the codebehind file for you.

> It'd just be nice to not have to make changes to source to 'make it Mono 
> compliant' since .NET should be .NET :)

You don't need to change the file containing the codebehind attribute.
What you have to do is: compile the codebehind file and put the assembly
into the bin folder of the ASP app.

Rob



More information about the Mono-list mailing list