DOCTYPE declarations not generated by ASP.NET

N

Neil Zanella

Hello,

I would like to know how come ASP.NET is not generating
any DOCTYPE declarations for the documents I am creating.
After all, if the HTTP user agent requesting the document
identifies itself as supporting modern XHTML standards then
I thought the IIS or Web Matrix or any other web server
supporting ASP.NET would output such a declaration.

So now I am wondering whether I should included it myself
or not. Cause I would like the XHTML output from my ASP.NET
code to be W3C (http://www.w3.org/) compliant. Is this
possible to achieve at all? Of course, W3C compliance
is desirable cause then I can check the ASP.NET output
validity against a validator such as http://validator.w3.org/

Thank you for your replies,

Neil
 
J

Joerg Jooss

Neil said:
Hello,

I would like to know how come ASP.NET is not generating
any DOCTYPE declarations for the documents I am creating.
After all, if the HTTP user agent requesting the document
identifies itself as supporting modern XHTML standards then
I thought the IIS or Web Matrix or any other web server

(WebMatrix is an IDE, not a Web server.)
supporting ASP.NET would output such a declaration.

That could be technically challenging in certain situations. And it wouldn't
even help. You cannot simply inject a DOCTYPE based on the user agent's
capabilites without knowing whether this might render the document invalid.
Out of the box, ASP.NET 1.1 doesn't render HTML 4.01 compliant code, not to
mention XHTML.
So now I am wondering whether I should included it myself
or not.

Actually, pages generated by VS.NET do include a DOCTYPE... which is broken
IMHO as well, as it forces both IE and Mozilla to render HTML in "quirks
mode". You can replace it with a correct header though.

Cause I would like the XHTML output from my ASP.NET
code to be W3C (http://www.w3.org/) compliant. Is this
possible to achieve at all? Of course, W3C compliance
is desirable cause then I can check the ASP.NET output
validity against a validator such as http://validator.w3.org/

There are quite a few articles on the web that describe possible fixes, like
http://www.liquid-internet.co.uk/content/dynamic/pages/series1article1.aspx
http://www.codeproject.com/aspnet/ASPNET2XHTML.asp
http://www.aspnetresources.com/articles/HttpFilters.aspx

Cheers,
 
N

nzanella

Thank you for your reply. Regarding Web Matrix though,
AFAIK it is both an IDE and a Web Server since when I
select View -> Start... or alternatively press F5 a window
opens up providing the option to use either the Web Matrix
Server or an IIS virtual root directory to view the URL for
the file on the default port of 8080.
Thank you for your feedback,

Regards,

Neil
 
J

John Saunders

Thank you for your reply. Regarding Web Matrix though,
AFAIK it is both an IDE and a Web Server since when I
select View -> Start... or alternatively press F5 a window
opens up providing the option to use either the Web Matrix
Server or an IIS virtual root directory to view the URL for
the file on the default port of 8080.

Web Matrix includes the Cassini web server, which is a separate thing.

John Saunders
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top