View Single Post
  #1 (permalink)  
Old March 5th, 2009, 10:33 AM
Will Will is offline
Friend of Wrox
 
Join Date: Feb 2009
Posts: 194
Thanks: 5
Thanked 3 Times in 3 Posts
Default Validation-visual Studio 2008

I am building a website and currently I have had a few issues with getting it to validate properly.

I had built my site to validate to xhtml 1.1 strict and it would validate fine on my local machine but when uploaded to the server I got 2 errors and this was because the ASP.NET was not generating some of the code to xhtml stict standards.

So after abit of research on the msdn documentation I found that you could alter the way the asp.net generates html in the web config file by setting the xhtmlConformance to strict, transitional etc I set it to strict.

After uploading the new webconfig file the site would still not validate in the w3c generator but when looking at the source in code through developer tool bar add on for firefox it told me that is was valid.

Imar then suggested in another post I made that the w3c validator probably was telling the asp.net that it couldn't serve strict markup and so it was changing it specifically for the validator (or something to that extent) so I just left it at that content that the actual markup was valid even if it wasn't being detected.

After reading a few articles and some research into why my site was appearing funny in a few browsers I decided that a strict html 4.01 doctype would server me better. So after changing the doctype and consequently the closing tags to conform to the new doctype and removing the xhtmlConformance from the webconfig file and uploading my site I find that it doesn't validate.

this time the validation errors are that my tags that are being generated are all because they are closed like /> instead of >. I don't understand why this is the case however as it has a html strict doctype and my page code everything is closed > accordingly.

So to summarise after that long post, I can't get asp.net to generate valid html code to comply with the doctype I have chosen the page to use. If anybody can help this would be great as I feel that solving this problem will help my sites display better amongst all the browsers.

To see the validation errors I am having with the current doctype tag plese click here.

The code for my MasterPage is here:
Code:
<%@ Master Language="VB" CodeFile="MasterPage.master.vb" Inherits="MasterPage" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html>

<head runat="server">
<title>Parker Designs</title>
<link href="~/Styles.css" type="text/css" rel="Stylesheet">
<!--[if IE 6]>
<link href="ie-styles.css" type="text/css" rel="Stylesheet">
<![endif]-->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<meta name="Keywords" content="Website, Design, Development, .NET, Will Parker, web designer, website designer, website developer, web developer">
<meta name="Description" content="Online portfolio for Will Parker a freelance website designer and .NET developer.">
<meta name="Author" content="william2002uk@hotmail.com">
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">

<!--*******************Page Wrapper******************-->
<div id="wrapper">

<!--********************Header**********************-->
<div id="header">
<a href="Default.aspx"></a>
</div>
<!--******************End of Header***************-->

<!--*****************Navigation***************-->
<div id="nav">
<ul>
<li><a href="Default.aspx">Home</a></li>
<li><a href="portfolio.aspx">Portfolio</a></li>
<li><a href="services.aspx">Services</a></li>
<li><a href="contact.aspx">Contact</a></li>
</ul>
</div>
<!--***************END of Navigation************-->

<!--**************main-content***************-->
<div id="main-content">

<!--***************leftcol placeholder****************-->
<div id="leftcol">
<asp:ContentPlaceHolder id="leftcolcon" runat="server">

</asp:ContentPlaceHolder>
</div>
<!--******************End of leftcol placeholder*********-->

<!--******************rightcol************-->
<div id="rightcol">
<h3>News & Updates 4th March 2009:</h3>
<p>Current portfolio website is nearly complete. Upon it's completion this portfolio will be transferring to my new domain www.will-parker.com</p>
<h3>Recent projects...</h3>
<img src="Images/Jade-Valley-250x165.jpg" alt="Jade Valley" class="photo" title="Image of Parker Designs redesign of the Jade Valley website">
<p>Jade Valley redesign click <a href="portfolio.aspx">here</a> to find out more.</p>

</div>
<!--***************End of rightcol************-->

</div>
<!--**************END of main-content********-->
<div class="clearfooter"></div>
</div>
<!--*********************End of wrapper****************-->

<!--***************footer*****************-->
<div id="footer">

<ul class="footernav">
<li><a href="Default.aspx">Home</a></li>
<li><a href="portfolio.aspx">Portfolio</a></li>
<li><a href="services.aspx">Services</a></li>
<li><a href="contact.aspx">Contact</a></li>
<li>&copy; 2009 <a href="Default.aspx">Parkerdsgn.com</a></li>
</ul>


</div>
<!--**********************End of Footer*********-->

</form>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-7763810-1");
pageTracker._trackPageview();
} catch(err) {}</script>
</body>
</html>
Which in turn generates this html:

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html>

<head><title>
Parker Designs- Freelance website designer and developer, Will Parker
</title><link href="Styles.css" type="text/css" rel="Stylesheet" />
<!--[if IE 6]>
<link href="ie-styles.css" type="text/css" rel="Stylesheet" />
<![endif]-->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /><meta name="Keywords" content="Website, Design, Development, .NET, Will Parker, web designer, website designer, website developer, web developer" /><meta name="Description" content="Online portfolio for Will Parker a freelance website designer and .NET developer." /><meta name="Author" content="william2002uk@hotmail.com" />
</head>
<body>
<form name="aspnetForm" method="post" action="Default.aspx" id="aspnetForm">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTEwMDUyNjYzMjhkZIm1knYf545rNmWGHN+LPAZ4AFT f" />
</div>


<!--*******************Page Wrapper******************-->
<div id="wrapper">

<!--********************Header**********************-->
<div id="header">
<a href="Default.aspx"></a>
</div>
<!--******************End of Header***************-->

<!--*****************Navigation***************-->
<div id="nav">
<ul>
<li><a href="Default.aspx">Home</a></li>
<li><a href="portfolio.aspx">Portfolio</a></li>
<li><a href="services.aspx">Services</a></li>
<li><a href="contact.aspx">Contact</a></li>
</ul>
</div>
<!--***************END of Navigation************-->

<!--**************main-content***************-->
<div id="main-content">

<!--***************leftcol placeholder****************-->
<div id="leftcol">

<h1>Parker Designs..Whats it all about?</h1>

<p>Parker Designs is a web-based company and online portfolio designed, built and maintained by Will Parker, dedicated to designing and coding w3c accessible, standards compliant websites. Whether you require a simple static page website or a more complex database driven one it isn’t a problem.</p>

<h2>Why Parker Designs?</h2>
<p>There are no shortage of Web designers and developers on the market so why should you choose me? I can offer an affordably priced website that <em>you</em> want to suit <em>your</em> needs. Just check out my <a href="portfolio.aspx">portfolio</a> to see some of my most recent works.</p>
<h2>How to get in touch</h2>
<p>If you would like to contact me to discuss working on a website for you then please click the contact me link in the navigation or click <a href="contact.aspx">here</a> to be taken straight to the contact page. If you would rather find out a bit more about me and what I offer first then please head over to the <a href="services.aspx">services</a> page. I hope to hear from you soon.</p>


</div>
<!--******************End of leftcol placeholder*********-->

<!--******************rightcol************-->
<div id="rightcol">
<h3>News & Updates 4th March 2009:</h3>
<p>Current portfolio website is nearly complete. Upon it's completion this portfolio will be transferring to my new domain www.will-parker.com</p>
<h3>Recent projects...</h3>
<img src="Images/Jade-Valley-250x165.jpg" alt="Jade Valley" class="photo" title="Image of Parker Designs redesign of the Jade Valley website">
<p>Jade Valley redesign click <a href="portfolio.aspx">here</a> to find out more.</p>

</div>
<!--***************End of rightcol************-->

</div>
<!--**************END of main-content********-->
<div class="clearfooter"></div>
</div>
<!--*********************End of wrapper****************-->

<!--***************footer*****************-->
<div id="footer">

<ul class="footernav">
<li><a href="Default.aspx">Home</a></li>
<li><a href="portfolio.aspx">Portfolio</a></li>
<li><a href="services.aspx">Services</a></li>
<li><a href="contact.aspx">Contact</a></li>
<li>&copy; 2009 <a href="Default.aspx">Parkerdsgn.com</a></li>
</ul>


</div>
<!--**********************End of Footer*********-->

</form>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-7763810-1");
pageTracker._trackPageview();
} catch(err) {}</script>
</body>
</html>
Thanks in advance. Hope it isn't too confusing.