Hello all,

I am trying to validate my ASP.NET page in W3C validator. I am getting following errors. Can anyone help with this?

No DOCTYPE found! Checking XML syntax only.

The DOCTYPE Declaration was not recognized or is missing. This probably means that the Formal Public Identifier contains a spelling error, or that the Declaration is not using correct syntax, or that your XML document is not using a DOCTYPE Declaration.

Validation of the document has been skipped, and a simple check of the well-formedness of the XML syntax has been performed instead.

Learn how to add a doctype to your document from our FAQ, or use the validator's option to validate your XML document against a specific Document Type

Byte-Order Mark found in UTF-8 File.

The Unicode Byte-Order Mark (BOM) in UTF-8 encoded files is known to cause problems for some text editors and older browsers. You may want to consider avoiding its use until it is better supported.

↑ TOP

Validation Output: 2 Errors

Line 1, Column 1: character "<%" not allowed in prolog
<% @ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireu…

Line 6, Column 77: document type does not allow element "asp:Content" here
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">

The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).

One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).

Thanking You,
Hakoo Desai.

You haven't added your HTMl so its hard to actually see what is wrong but if you have a <DOC> declaration below your aspx page and register directives it should be detected.

Actually, are you passing the validator the actual aspx file or validating the page online (passing the URL)? Because that will make difference to what the validator sees, server side code not appearing online of course.

hi Hericles,

I have uploaded the aspx file to validate from my laptop through local host.

I think hericles has got it right...
In a web browser go the your localhost address for the page you want to validate. "View Source" of that page, and copy and paste that into the validator.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.