Jump to content

ASP.NET Strict 1.1 Validation W3C ("This page is not Valid XHTML 1.1!")


FrostbiteXIII

Recommended Posts

Hey folks, sorry if this is something obvious, but I am just starting to properly get into ASP.NET (using MS Visual Web Developer 2005 Express Edition), and I am trying to validate my web page, and get this:

This page is not Valid XHTML 1.1!Below are the results of checking this document for XML well-formedness and validity. 1. Error Line 22 column 15: there is no attribute "name". <form name="aspnetForm" method="post" action="Default.aspx" id="aspnetForm"> You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead). This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information. How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute. If you received this error when using the <embed> element to incorporate flash media in a Web page, see the FAQ item on valid flash. ✉ 2. Error Line 23 column 195: document type does not allow element "input" here; missing one of "ins", "del", "h1", "h2", "h3", "h4", "h5", "h6", "p", "div", "address", "fieldset" start-tag. ...A3ZGRkdkVyBQuIwJ61Vl2vS1J9uWqS3+k=" /> The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element. One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").
Is there an easy (obvious) way around this, or is it the kind of thing that is just broken?Viewing my source code, I can find these lines:
</head><body>    <form name="aspnetForm" method="post" action="Default.aspx" id="aspnetForm"><div><input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJNDMyNDU0NjAzD2QWAmYPZBYCAgMPZBYEAgcPDxYCHgRUZXh0BQQyMDA3ZGQCCQ8PFgIfAAUMTWF5IDA5LCAyMDA3ZGRkdkVyBQuIwJ61Vl2vS1J9uWqS3+k=" /></div>    <div class="lvl1section">

But not in asp.net code...Any ideas (again, sorry, I imagine this is a stupid question, but couldnt find the answer anywhere!)?Many thanks in advance,Bob

Link to comment
Share on other sites

those lines are generated by .Net to remember the view state on postback.On to your problem... read this article it will explain how to force .Net to output strict XHTMLhttp://weblogs.asp.net/scottgu/archive/200.../03/424363.aspxNow you won't be able to put the W3C validation links on your page because for some reason they will always say not valid xhtml (.Net thinks the validator is an older browser so it auto serves some older html code).You will have to go tot he validator page and either paste in the generated xhtml source or provide the url to your page.

Link to comment
Share on other sites

Thanks again, for anyone too lazy to read the link, you just need to add this line to your web.config:

<xhtmlConformance mode="Strict" />

Also, even typing in the link to the web page didnt seem to work for me - I actually had to do the other thing you suggested and view source, copy, and paste the code...Thanks again!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...