The "Src" directive won't work for me. I get compilation errors under both Mono 
and .Net (attached).

(K)
-----Original Message-----
From: peter [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 03, 2006 6:57 PM
To: Arnhoffer Károly
Cc: mono-devel-list@lists.ximian.com
Subject: Re: [Mono-dev] Controls in HTML comment block behave different in .Net 
and Mono


You may have fallen foul of the same thing I did:


Codebehind="WebForm1.aspx.cs"


is a Visual Studio thing, apparently.  You want to replace "CodeBehind" with 
"Src".

It worked for me, anyway.

Cheers


Peter

Arnhoffer Károly wrote: 
Hi,

When I have an ASP.Net control in an HTML comment block of an aspx page it does 
not compile under Mono but it does compile under .Net.

Exmple aspx:

<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" 
Inherits="MonoCharsetTest.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
        <HEAD>
                <title>WebForm1</title>
                <meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
                <meta name="CODE_LANGUAGE" Content="C#">
                <meta name="vs_defaultClientScript" content="JavaScript">
                <meta name="vs_targetSchema" 
content="http://schemas.microsoft.com/intellisense/ie5";>
                <meta name="Content-Type" content="text/html; charset=utf-8">
        </HEAD>
        <body>
                <form id="Form1" method="post" runat="server">
                        <!--
                        <INPUT id="Button1" type="button" value="Button" 
name="Button1" runat="server">
                        -->
                </form>
        </body>
</HTML>

Example cs:

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace MonoCharsetTest
{
        /// <summary>
        /// Summary description for WebForm1.
        /// </summary>
        public class WebForm1 : System.Web.UI.Page
        {
                protected System.Web.UI.HtmlControls.HtmlInputButton Button1;
        
                private void Page_Load(object sender, System.EventArgs e)
                {
                        // Put user code to initialize the page here
                        Button1.Value="Hello";
                }

                #region Web Form Designer generated code
                override protected void OnInit(EventArgs e)
                {
                        //
                        // CODEGEN: This call is required by the ASP.NET Web 
Form Designer.
                        //
                        InitializeComponent();
                        base.OnInit(e);
                }
                
                /// <summary>
                /// Required method for Designer support - do not modify
                /// the contents of this method with the code editor.
                /// </summary>
                private void InitializeComponent()
                {    
                        this.Load += new System.EventHandler(this.Page_Load);

                }
                #endregion

        }
}

Results when running on mono: 

Server error in '/c' application

--------------------------------------------------------------------------------

Description: Error processing request. 
Error Message: HTTP 500. 

Stack Trace: System.NullReferenceException: Object reference not set to an 
instance of an object
in <0x00012> MonoCharsetTest.WebForm1: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 <0x000e5> System.Web.UI.Control:LoadRecursive ()
in <0x0011e> System.Web.UI.Page:InternalProcessRequest ()
in <0x000a4> System.Web.UI.Page:ProcessRequest (System.Web.HttpContext context)
 
With .Net I get a page without the button and no compilation error.

Wich is the right behaviour?
VS.Net project, Mono and .Net results are attached.

Thanks!

Károly
  





 





Server error in '/c' application


Description: Error processing request. 
Error Message: HTTP 500. 
Stack Trace: System.NullReferenceException: Object reference not set to an 
instance of an object
in <0x00012> MonoCharsetTest.WebForm1: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 <0x000e5> System.Web.UI.Control:LoadRecursive ()
in <0x0011e> System.Web.UI.Page:InternalProcessRequest ()
in <0x000a4> System.Web.UI.Page:ProcessRequest (System.Web.HttpContext context)






_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list
  
Title: Compilation Error

GFI MailSecurity's HTML threat engine found HTML scripts in this email and has disabled them.

Server Error in '/MonoCharsetTest' Application.

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS1595: 'MonoCharsetTest.WebForm1' is defined in multiple places; using definition from 'c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\monocharsettest\77a20930\4a0b24c7\nxpbcymc.dll'

Source Error:

Line 27:     
Line 28:     [System.Runtime.CompilerServices.CompilerGlobalScopeAttribute()]
Line 29:     public class WebForm1_aspx : MonoCharsetTest.WebForm1, System.Web.SessionState.IRequiresSessionState {
Line 30:         
Line 31:         

Source File: c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\monocharsettest\77a20930\4a0b24c7\zdxvyp3s.0.cs    Line: 29






Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET Version:1.1.4322.2032
Title: Compilation Error

Server Error in '/c' Application


Compilation Error

Description: Error compiling a resource required to service this request. Review your source file and modify it to fix this error.

Error message: /tmp/root-temp-aspnet-0/d30c4d17/94189.0.cs(26,34) : error CS0433: The imported type `MonoCharsetTest.WebForm1' is defined multiple times

File name: /home/karnhoffer/public_html/mod_mono_c_test/WebForm1.aspx

Source File: /tmp/root-temp-aspnet-0/d30c4d17/94189.0.cs

Line 1: // ------------------------------------------------------------------------------
Line 2: //  <autogenerated>
Line 3: //      This code was generated by a tool.
Line 4: //      Mono Runtime Version: 1.1.4322.2032
Line 5: // 
Line 6: //      Changes to this file may cause incorrect behavior and will be lost if 
Line 7: //      the code is regenerated.
Line 8: //  </autogenerated>
Line 9: // ------------------------------------------------------------------------------
Line 10: 
Line 11: namespace ASP {
Line 12:     using System;
Line 13:     using System.Collections;
Line 14:     using System.Collections.Specialized;
Line 15:     using System.Configuration;
Line 16:     using System.Text;
Line 17:     using System.Text.RegularExpressions;
Line 18:     using System.Web;
Line 19:     using System.Web.Caching;
Line 20:     using System.Web.Security;
Line 21:     using System.Web.SessionState;
Line 22:     using System.Web.UI;
Line 23:     using System.Web.UI.WebControls;
Line 24:     using System.Web.UI.HtmlControls;
Line 25:     
Line 26:     public class WebForm1_aspx : MonoCharsetTest.WebForm1, System.Web.SessionState.IRequiresSessionState {
Line 27:         
Line 28:         private static bool __intialized = false;
Line 29:         
Line 30:         protected System.Web.UI.HtmlControls.HtmlForm Form1;
Line 31:         
Line 32:         public WebForm1_aspx() {
Line 33:             if ((ASP.WebForm1_aspx.__intialized == false)) {
Line 34:                 ASP.WebForm1_aspx.__intialized = true;
Line 35:             }
Line 36:         }
Line 37:         
Line 38:         protected override bool SupportAutoEvents {
Line 39:             get {
Line 40:                 return false;
Line 41:             }
Line 42:         }
Line 43:         
Line 44:         protected System.Web.HttpApplication ApplicationInstance {
Line 45:             get {
Line 46:                 return ((System.Web.HttpApplication)(this.Context.ApplicationInstance));
Line 47:             }
Line 48:         }
Line 49:         
Line 50:         public override string TemplateSourceDirectory {
Line 51:             get {
Line 52:                 return "/c";
Line 53:             }
Line 54:         }
Line 55:         
Line 56:         private void __BuildControlTree(System.Web.UI.Control __ctrl) {
Line 57:             System.Web.UI.IParserAccessor __parser = ((System.Web.UI.IParserAccessor)(__ctrl));
Line 58:             __parser.AddParsedSubObject(new System.Web.UI.LiteralControl("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\" >\n<HTML>\n\t<HEAD>\n\t\t<title>WebForm1</title>\n\t\t<meta name=\"GENERATOR\" Content=\"Microsoft Visual Studio 7.0\">\n\t\t<meta name=\"CODE_LANGUAGE\" Content=\"C#\">\n\t\t<meta name=\"vs_defaultClientScript\" content=\"_javascript_\">\n\t\t<meta name=\"vs_targetSchema\" content=\"http://schemas.microsoft.com/intellisense/ie5\">\n\t\t<meta name=\"Content-Type\" content=\"text/html; charset=utf-8\">\n\t</HEAD>\n\t<body>\n\t\t"));
Line 59:             this.__BuildControl_Form1();
Line 60:             __parser.AddParsedSubObject(this.Form1);
Line 61:             __parser.AddParsedSubObject(new System.Web.UI.LiteralControl("\n\t</body>\n</HTML>\n"));
Line 62:         }
Line 63:         
Line 64:         private System.Web.UI.Control __BuildControl_Form1() {
Line 65:             System.Web.UI.HtmlControls.HtmlForm __ctrl;
Line 66:             __ctrl = new System.Web.UI.HtmlControls.HtmlForm();
Line 67:             this.Form1 = __ctrl;
Line 68:             __ctrl.ID = "Form1";
Line 69:             __ctrl.Method = "post";
Line 70:             System.Web.UI.IParserAccessor __parser = ((System.Web.UI.IParserAccessor)(__ctrl));
Line 71:             __parser.AddParsedSubObject(new System.Web.UI.LiteralControl("\n\t\t\t<!--\n\t\t\t<INPUT id=\"Button1\" type=\"button\" value=\"Button\" name=\"Button1\" runat=\"server\">\n\t\t\t-->\n\t\t"));
Line 72:             return __ctrl;
Line 73:         }
Line 74:         
Line 75:         protected override void FrameworkInitialize() {
Line 76:             this.TraceModeValue = System.Web.TraceMode.SortByTime;
Line 77:             this.Request.ValidateInput();
Line 78:             this.__BuildControlTree(this);
Line 79:         }
Line 80:         
Line 81:         public override int GetTypeHashCode() {
Line 82:             return 2022280611;
Line 83:         }
Line 84:     }
Line 85:     
Line 86: }


_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list

Reply via email to