I installed Mono and MonoDevelop 2.2 on my Windows PC.
Created a default C# ASP.NET Web Application project. Here's the Default.aspx it created:<%@ Page Language="C#" Inherits="test.Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head runat="server">
<title>Default</title>
</head>
<body>
<form id="form1" runat="server">
<asp:Button id="button1" runat="server" Text="Click me!" OnClick="button1Clicked" />
</form>
</body>
</html>
When I run it it feeds this html to the browser:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head><t开发者_如何学运维itle>
Default
</title></head>
<body>
<form name="form1" method="post" action="Default.aspx" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKMTQ2OTkzNDMyMWRkjWseIg+2HCgaNiY+XHmVKEq/CFg=" />
</div>
<div>
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWAgLB5qLABwKs34rGBvJAYc3UJn3AcjSPjq8DVpMxclAk" />
</div>
<input type="submit" name="button1" value="Click me!" id="button1" />
</form>
</body>
</html>
XHTML validation fails with 3 errors:
1. Line 3, Column 1: Missing xmlns attribute for element html. The value should be: http://www.w3.org/1999/xhtml 2. Line 8, Column 13: there is no attribute "name" 3. Line 17, Column 71: document type does not allow element "input" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tagIs there some setting I'm missing?
Apparently the problem is in the Microsoft .NET runtime.
In MonoDevelop under Project menu there is sub-menu Active Runtime
.
Switching it from Microsoft .NET to Mono fixes the problem!
Try this: How to: Configure XHTML Rendering in ASP.NET Web Sites
I don't think this has to do with Mono. Change <html>
to <html xmlns='http://www.w3.org/1999/xhtml'>
.
精彩评论