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
Show Detailed Compiler Output:
C:\WINDOWS\system32> "c:\windows\microsoft.net\framework\v1.1.4322\csc.exe" /t:library /utf8output /R:"c:\windows\assembly\gac\system.drawing\1.0.5000.0__b03f5f7f11d50a3a\system.drawing.dll" /R:"c:\windows\assembly\gac\system.xml\1.0.5000.0__b77a5c561934e089\system.xml.dll" /R:"c:\windows\assembly\gac\system.web.services\1.0.5000.0__b03f5f7f11d50a3a\system.web.services.dll" /R:"c:\windows\assembly\gac\system\1.0.5000.0__b77a5c561934e089\system.dll" /R:"c:\windows\assembly\gac\system.web\1.0.5000.0__b03f5f7f11d50a3a\system.web.dll" /R:"c:\windows\microsoft.net\framework\v1.1.4322\temporary asp.net files\monocharsettest\77a20930\4a0b24c7\qljgmtrh.dll" /R:"c:\windows\microsoft.net\framework\v1.1.4322\temporary asp.net files\monocharsettest\77a20930\4a0b24c7\nxpbcymc.dll" /R:"c:\windows\microsoft.net\framework\v1.1.4322\mscorlib.dll" /R:"c:\windows\microsoft.net\framework\v1.1.4322\temporary asp.net files\monocharsettest\77a20930\4a0b24c7\assembly\dl2\e0b8a402\defcd133_eb2ac601\monocharsettest.dll" /R:"c:\windows\assembly\gac\system.enterpriseservices\1.0.5000.0__b03f5f7f11d50a3a\system.enterpriseservices.dll" /R:"c:\windows\assembly\gac\system.data\1.0.5000.0__b77a5c561934e089\system.data.dll" /R:"c:\windows\assembly\gac\system.web.mobile\1.0.5000.0__b03f5f7f11d50a3a\system.web.mobile.dll" /out:"C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\monocharsettest\77a20930\4a0b24c7\zdxvyp3s.dll" /D:DEBUG /debug+ /optimize- /win32res:"C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\monocharsettest\77a20930\4a0b24c7\zdxvyp3s.res" /warnaserror /w:1 "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\monocharsettest\77a20930\4a0b24c7\zdxvyp3s.0.cs"
Microsoft (R) Visual C# .NET Compiler version 7.10.6001.4
for Microsoft (R) .NET Framework version 1.1.4322
Copyright (C) Microsoft Corporation 2001-2002. All rights reserved.
c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\monocharsettest\77a20930\4a0b24c7\zdxvyp3s.0.cs(29,34): error 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'
|
Show
Complete Compilation Source:
Line 1: //------------------------------------------------------------------------------
Line 2: // <autogenerated>
Line 3: // This code was generated by a tool.
Line 4: // 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.SessionState;
Line 21: using System.Web.Security;
Line 22: using System.Web.UI;
Line 23: using System.Web.UI.WebControls;
Line 24: using System.Web.UI.HtmlControls;
Line 25: using ASP;
Line 26:
Line 27:
Line 28: [System.Runtime.CompilerServices.CompilerGlobalScopeAttribute()]
Line 29: public class WebForm1_aspx : MonoCharsetTest.WebForm1, System.Web.SessionState.IRequiresSessionState {
Line 30:
Line 31:
Line 32: #line 13 "c:\inetpub\wwwroot\MonoCharsetTest\WebForm1.aspx"
Line 33: protected System.Web.UI.HtmlControls.HtmlForm Form1;
Line 34:
Line 35: #line default
Line 36: #line hidden
Line 37:
Line 38: private static bool __initialized = false;
Line 39:
Line 40: private static object __stringResource;
Line 41:
Line 42: private static System.Collections.ArrayList __fileDependencies;
Line 43:
Line 44: public WebForm1_aspx() {
Line 45: System.Collections.ArrayList dependencies;
Line 46: if ((ASP.WebForm1_aspx.__initialized == false)) {
Line 47: ASP.WebForm1_aspx.__stringResource = System.Web.UI.TemplateControl.ReadStringResource(typeof(ASP.WebForm1_aspx));
Line 48: dependencies = new System.Collections.ArrayList();
Line 49: dependencies.Add("c:\\inetpub\\wwwroot\\MonoCharsetTest\\WebForm1.aspx.cs");
Line 50: dependencies.Add("c:\\inetpub\\wwwroot\\MonoCharsetTest\\WebForm1.aspx");
Line 51: ASP.WebForm1_aspx.__fileDependencies = dependencies;
Line 52: ASP.WebForm1_aspx.__initialized = true;
Line 53: }
Line 54: this.Server.ScriptTimeout = 30000000;
Line 55: }
Line 56:
Line 57: protected override bool SupportAutoEvents {
Line 58: get {
Line 59: return false;
Line 60: }
Line 61: }
Line 62:
Line 63: protected ASP.Global_asax ApplicationInstance {
Line 64: get {
Line 65: return ((ASP.Global_asax)(this.Context.ApplicationInstance));
Line 66: }
Line 67: }
Line 68:
Line 69: public override string TemplateSourceDirectory {
Line 70: get {
Line 71: return "/MonoCharsetTest";
Line 72: }
Line 73: }
Line 74:
Line 75: private System.Web.UI.Control __BuildControlButton1() {
Line 76: System.Web.UI.HtmlControls.HtmlInputButton __ctrl;
Line 77:
Line 78: #line 15 "c:\inetpub\wwwroot\MonoCharsetTest\WebForm1.aspx"
Line 79: __ctrl = new System.Web.UI.HtmlControls.HtmlInputButton();
Line 80:
Line 81: #line default
Line 82: #line hidden
Line 83: this.Button1 = __ctrl;
Line 84:
Line 85: #line 15 "c:\inetpub\wwwroot\MonoCharsetTest\WebForm1.aspx"
Line 86: __ctrl.ID = "Button1";
Line 87:
Line 88: #line default
Line 89: #line hidden
Line 90:
Line 91: #line 15 "c:\inetpub\wwwroot\MonoCharsetTest\WebForm1.aspx"
Line 92: ((System.Web.UI.IAttributeAccessor)(__ctrl)).SetAttribute("type", "button");
Line 93:
Line 94: #line default
Line 95: #line hidden
Line 96:
Line 97: #line 15 "c:\inetpub\wwwroot\MonoCharsetTest\WebForm1.aspx"
Line 98: __ctrl.Value = "Button";
Line 99:
Line 100: #line default
Line 101: #line hidden
Line 102:
Line 103: #line 15 "c:\inetpub\wwwroot\MonoCharsetTest\WebForm1.aspx"
Line 104: __ctrl.Name = "Button1";
Line 105:
Line 106: #line default
Line 107: #line hidden
Line 108: return __ctrl;
Line 109: }
Line 110:
Line 111: private System.Web.UI.Control __BuildControlForm1() {
Line 112: System.Web.UI.HtmlControls.HtmlForm __ctrl;
Line 113:
Line 114: #line 13 "c:\inetpub\wwwroot\MonoCharsetTest\WebForm1.aspx"
Line 115: __ctrl = new System.Web.UI.HtmlControls.HtmlForm();
Line 116:
Line 117: #line default
Line 118: #line hidden
Line 119: this.Form1 = __ctrl;
Line 120:
Line 121: #line 13 "c:\inetpub\wwwroot\MonoCharsetTest\WebForm1.aspx"
Line 122: __ctrl.ID = "Form1";
Line 123:
Line 124: #line default
Line 125: #line hidden
Line 126:
Line 127: #line 13 "c:\inetpub\wwwroot\MonoCharsetTest\WebForm1.aspx"
Line 128: __ctrl.Method = "post";
Line 129:
Line 130: #line default
Line 131: #line hidden
Line 132: System.Web.UI.IParserAccessor __parser = ((System.Web.UI.IParserAccessor)(__ctrl));
Line 133:
Line 134: #line 13 "c:\inetpub\wwwroot\MonoCharsetTest\WebForm1.aspx"
Line 135: __parser.AddParsedSubObject(new System.Web.UI.LiteralControl("\r\n\t\t\t<!--\r\n\t\t\t"));
Line 136:
Line 137: #line default
Line 138: #line hidden
Line 139:
Line 140: #line 13 "c:\inetpub\wwwroot\MonoCharsetTest\WebForm1.aspx"
Line 141: this.__BuildControlButton1();
Line 142:
Line 143: #line default
Line 144: #line hidden
Line 145:
Line 146: #line 13 "c:\inetpub\wwwroot\MonoCharsetTest\WebForm1.aspx"
Line 147: __parser.AddParsedSubObject(this.Button1);
Line 148:
Line 149: #line default
Line 150: #line hidden
Line 151:
Line 152: #line 13 "c:\inetpub\wwwroot\MonoCharsetTest\WebForm1.aspx"
Line 153: __parser.AddParsedSubObject(new System.Web.UI.LiteralControl("\r\n\t\t\t-->\r\n\t\t"));
Line 154:
Line 155: #line default
Line 156: #line hidden
Line 157: return __ctrl;
Line 158: }
Line 159:
Line 160: private void __BuildControlTree(System.Web.UI.Control __ctrl) {
Line 161: System.Web.UI.IParserAccessor __parser = ((System.Web.UI.IParserAccessor)(__ctrl));
Line 162:
Line 163: #line 1 "c:\inetpub\wwwroot\MonoCharsetTest\WebForm1.aspx"
Line 164: __parser.AddParsedSubObject(this.CreateResourceBasedLiteralControl(0, 456, true));
Line 165:
Line 166: #line default
Line 167: #line hidden
Line 168:
Line 169: #line 1 "c:\inetpub\wwwroot\MonoCharsetTest\WebForm1.aspx"
Line 170: this.__BuildControlForm1();
Line 171:
Line 172: #line default
Line 173: #line hidden
Line 174:
Line 175: #line 1 "c:\inetpub\wwwroot\MonoCharsetTest\WebForm1.aspx"
Line 176: __parser.AddParsedSubObject(this.Form1);
Line 177:
Line 178: #line default
Line 179: #line hidden
Line 180:
Line 181: #line 1 "c:\inetpub\wwwroot\MonoCharsetTest\WebForm1.aspx"
Line 182: __parser.AddParsedSubObject(new System.Web.UI.LiteralControl("\r\n\t</body>\r\n</HTML>\r\n"));
Line 183:
Line 184: #line default
Line 185: #line hidden
Line 186: }
Line 187:
Line 188: protected override void FrameworkInitialize() {
Line 189: SetStringResourcePointer(ASP.WebForm1_aspx.__stringResource, 456);
Line 190: this.__BuildControlTree(this);
Line 191: this.FileDependencies = ASP.WebForm1_aspx.__fileDependencies;
Line 192: this.EnableViewStateMac = true;
Line 193: this.Request.ValidateInput();
Line 194: }
Line 195:
Line 196: public override int GetTypeHashCode() {
Line 197: return 595945895;
Line 198: }
Line 199: }
Line 200: }
Line 201:
|
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 ErrorDescription:
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