This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 3734 - Discrepencies in ASP.NET Validation
Summary: Discrepencies in ASP.NET Validation
Status: RESOLVED INVALID
Alias: None
Product: Validator
Classification: Unclassified
Component: Website (show other bugs)
Version: HEAD
Hardware: PC Windows XP
: P2 critical
Target Milestone: ---
Assignee: Olivier Thereaux
QA Contact: qa-dev tracking
URL: http://www.buybigtal.com/content/cont...
Whiteboard:
Keywords:
: 5304 5484 6108 6246 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-09-16 00:40 UTC by Craig Thacker
Modified: 2008-11-23 03:41 UTC (History)
5 users (show)

See Also:


Attachments

Description Craig Thacker 2006-09-16 00:40:33 UTC
Ladies/Gentlemen:

The following Bug Report is being presented.  I have searched the Bug Database using the keyword, asp.net, and have found no references to any bug reports referencing ASP.NET.

The W3C Validation Service is rendering code differently, under certain conditions, than any test browser and any additional validation application.

The specifics are as follows:

The Web page content used as an example:  http://www.buybigtal.com/content/contact/contact.aspx

Source code from the production server W3C Validation Service

<form name="contact" method="post" action="contact.aspx" id="contact" class="Request1">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTE0Mzg3MjU0MTFkZJ6rtdkYot2lfo7Wmc4no0eXvOqo" />

NOTE: The remaining two input tags as reflected below are tossed in randomly within the source code of the W3C Validation Service.  Only the first one that appears immediately following the form tag have been pasted into this bug report.



Source code from the production server Internet Explorer v5.01

<form method="post" action="contact.aspx" onsubmit="javascript:return WebForm_OnSubmit();" id="contact" class="Request1">
<div>
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTE0Mzg3MjU0MTFkZJ6rtdkYot2lfo7Wmc4no0eXvOqo" />
</div>



Source code from the production server Internet Explorer v5.5

<form method="post" action="contact.aspx" onsubmit="javascript:return WebForm_OnSubmit();" id="contact" class="Request1">
<div>
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTE0Mzg3MjU0MTFkZJ6rtdkYot2lfo7Wmc4no0eXvOqo" />
</div>



Source code from the production server Internet Explorer v6.0 SP1

<form method="post" action="contact.aspx" onsubmit="javascript:return WebForm_OnSubmit();" id="contact" class="Request1">
<div>
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTE0Mzg3MjU0MTFkZJ6rtdkYot2lfo7Wmc4no0eXvOqo" />
</div>


Source code from the production server Internet Explorer v7.0 RC1

<form method="post" action="contact.aspx" onsubmit="javascript:return WebForm_OnSubmit();" id="contact" class="Request1">
<div>
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTE0Mzg3MjU0MTFkZJ6rtdkYot2lfo7Wmc4no0eXvOqo" />
</div>


Source code from the production server Mozilla Firefox v1.5.0.6

<form method="post" action="contact.aspx" onsubmit="javascript:return WebForm_OnSubmit();" id="contact" class="Request1">
<div>
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTE0Mzg3MjU0MTFkZJ6rtdkYot2lfo7Wmc4no0eXvOqo" />
</div>

Source code from the production server Opera v9.01

<form method="post" action="contact.aspx" onsubmit="javascript:return WebForm_OnSubmit();" id="contact" class="Request1">
<div>
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTE0Mzg3MjU0MTFkZJ6rtdkYot2lfo7Wmc4no0eXvOqo" />
</div>

The same output occurs within the above browsers when code is outputed via the testing server, except as mentioned in NOTE 1, below.

The production server is running Microsoft Windows Server 2003 SP1, IIS v6.0, .NET Framework v2.0
The testing server is running Microsoft Windows XP SP2, IIS v6.0, .NET Framework v3.0 RC1

The following DTDs have been listed within the Web content and both produce the same result on the testing server, production servers and all browsers, including the W3C Validation Service.

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet type="text/css" href="http://www.w3.org/MarkUp/style/xhtml2.css"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

NOTE 1: On the testing server, for obvious reasons, the value tag value was different than that of the production server.

NOTE 2: The use of the xml stylesheet reference used with the XHMTL v1.1 DTD is used to throw Internet Explorer 7.0 into Quirks mode.

NOTE 3: All the above DTDs have been tested when content MIME type with .NET Framework v2.0 had been set to application/xhtml+xml and when it has been left to .NET Framework's v2.0 default of text/html. The above referenced output remains the same.

THE RAW CODE

<form action="https://www.buybigtall.com/web/content/contact/contact.aspx"
      method="post" id="contact" class="Request1" runat="server">

      <div><asp:label id="lblErrMsg" runat="server"></asp:label></div>
      <asp:panel id="pnlForm" runat="server">
	  
      <div class="tofield">
	  
      <p id="RequestHeader">e-Mail Your Comments and Questions<span class="blue">.</span></p>

      <asp:label runat="server" accesskey="1"
      AssociatedControlID="Send">To:<span class="red">*</span>
      <asp:dropdownlist id="Send" runat="server" 
      tabindex="300" title="Select from the Menu List.">
      <asp:listitem value="" selected="True"
      title="Please select an e-Mail category from the items listed below"
      text="[Select from the Menu]" />
      <asp:listitem value="accessibility@buybigtall.com" 
      text="Accessibility" title="e-Mail me about any Accessibility issues." />
      <asp:listitem value="copyright@buybigtall.com" 
      text="Copyright" title="e-Mail me about any Copyright issues." />
      <asp:listitem value="feedback@buybigtall.com" 
      text="Feedback" title="e-Mail me about any Feedback issues." />
      <asp:listitem value="giftcerts@buybigtall.com" 
      text="Gift Certificates" title="e-Mail me about any Gift Certificate issues." />
      <asp:listitem value="giftwrap@buybigtall.com" 
      text="Gift Wrapping" title="e-Mail me about any Gift Wrapping issues." />
      <asp:listitem value="guarantee@buybigtall.com" 
      text="Guarantee - Product" title="e-Mail me about any Product Guarantee issues." />
      <asp:listitem value="info@buybigtall.com" 
      text="Information - General" title="e-Mail me about any General Information issues." />
      <asp:listitem value="newsletter@buybigtall.com" 
      text="Newsletter - Subscription" title="e-Mail me about any Newsletter issues." />
      <asp:listitem value="optout@buybigtall.com" 
      text="Opt Out" title="e-Mail me to Opt Out or Cancel andy e-Mail subscriptions." />
      <asp:listitem value="placing@buybigtall.com" 
      text="Order - Placing an Order" title="e-Mail me about any Order Placement issues." />
      <asp:listitem value="personalshopper@buybigtall.com" 
      text="Personal Shopping Service" title="e-Mail me about any Personal Shopping issues." />
      <asp:listitem value="pgp@buybigtall.com"
      text="Pretty Good Privacy" title="e-Mail me about any PGP issues." />
      <asp:listitem value="productcare@buybigtall.com" 
      text="Product Care" title="e-Mail me about any Product Care issues." />
      <asp:listitem value="privacy@buybigtall.com" 
      text="Privacy Policy" title="e-Mail me about any Privacy Policy issues." />
      <asp:listitem value="return@buybigtall.com" 
      text="Product Returns" title="e-Mail me about any Product Return issues." />
      <asp:listitem value="safety@buybigtall.com" 
      text="Safety Policy" title="e-Mail me about any Safety Policy issues." />
      <asp:listitem value="sales@buybigtall.com" 
      text="Sales - Product" title="e-Mail me with any Product Sales issues." />
      <asp:listitem value="shipping@buybigtall.com" 
      text="Shipping Policy" title="e-Mail me about any Shipping Policy issues." />
      <asp:listitem value="requests@buybigtall.com" 
      text="Special Requests" title="e-Mail me about any Special Request issues." />
      <asp:listitem value="tou@buybigtall.com" 
      text="Terms of Use" title="e-Mail me about any Terms of Use issues." />
      <asp:listitem value="Webmaster@buybigtall.com" 
      text="Webmaster" title="e-Mail me about any Web Site or Performance issues." />
      <asp:listitem value="buybigtall@cprgltd.com" 
      text="Web Content for Sale" title="e-Mail me about any questions regarding the sale of this content." />
      <asp:listitem />
      </asp:dropdownlist>
      <asp:requiredfieldvalidator id="RequiredFieldValidator1" runat="server"
      errormessage="Select a valid menu item." controltovalidate="Send"
      display="Dynamic" CssClass="valid"></asp:requiredfieldvalidator>
      <asp:regularexpressionvalidator id="RegularExpressionValidator1"
      runat="server" errormessage="Select a valid menu item."
      controltovalidate="Send" display="Dynamic" CssClass="valid"
      validationexpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:regularexpressionvalidator>	  
      </asp:label>

      </div>
	  
	  <div class="namefield">
      
      <asp:label runat="server" accesskey="2"
	  AssociatedControlID="Name">Name:<span class="red">*</span>      
      <asp:textbox id="Name" runat="server" MaxLength="34"
      tabindex="301" accesskey="&" ToolTip="Enter Your Name." />      
      <asp:requiredfieldvalidator id="RequiredFieldValidator2" runat="server"
      errormessage="Name: &nbsp; Please enter your name." CssClass="valid"
      controltovalidate="Name" display="Dynamic"></asp:requiredfieldvalidator>
      <asp:regularexpressionvalidator id="RegularExpressionValidator2"
      runat="server" 
      errormessage="Name: &nbsp; Please enter your name, alpha characters only."
      controltovalidate="Name" display="Dynamic" CssClass="valid"
      validationexpression="^[a-zA-Z'_\-\w\s]{1,40}$"></asp:regularexpressionvalidator>
	  </asp:label>
        
      </div>
	  
	  <div class="fromfield">

      <asp:label runat="server" accesskey="3"
	  AssociatedControlID="From">From:<span class="red">*</span>      
      <asp:textbox id="From" runat="server" MaxLength="34" accesskey="."
      tabindex="302" ToolTip="Enter Your e-Mail Address Here." />      
      <asp:requiredfieldvalidator id="RequiredFieldValidator3" runat="server"
      errormessage="From:&nbsp; Please enter your e-Mail address." controltovalidate="From"
      display="Dynamic" CssClass="valid"></asp:requiredfieldvalidator>
      <asp:regularexpressionvalidator id="RegularExpressionValidator3"
      runat="server" errormessage="Please enter a valid e-Mail address."
      controltovalidate="From" display="Dynamic" CssClass="valid"
      validationexpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">
	  </asp:regularexpressionvalidator>      
      </asp:label>
     
      </div>
	  
	  <div class="ccfield">
      
      <asp:label runat="server" accesskey="4"
	  AssociatedControlID="CC">CC:      
      <asp:textbox id="CC" runat="server" MaxLength="34" accesskey="="
      tabindex="303" ToolTip="Enter Courtesy Copy e-Mail Address." />      
      <asp:regularexpressionvalidator id="RegularExpressionValidator4"
      runat="server" errormessage="CC: &nbsp; Please enter a valid e-Mail address."
      controltovalidate="CC" display="Dynamic" CssClass="valid"
      validationexpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">
	  </asp:regularexpressionvalidator>      
      </asp:label>
  
      </div> 
	  
	  <div class="subjectfield">

      <asp:label runat="server" accesskey="5"
	  AssociatedControlID="Subject">Subject:<span class="red">*</span>      
      <asp:textbox id="Subject" runat="server" MaxLength="34"
      tabindex="304" accesskey="\" ToolTip="Enter the Subject Matter Here." />        
      <asp:requiredfieldvalidator id="RequiredFieldValidator5" runat="server"
      errormessage="Subject: &nbsp; Please enter a subject using alphanumeric characters, only."
      controltovalidate="Subject" display="Dynamic" CssClass="valid"></asp:requiredfieldvalidator>
      <asp:regularexpressionvalidator id="RegularExpressionValidator5"
      runat="server" errormessage="Subject: &nbsp; Please limit the subject to alphanumeric characters only!"
      controltovalidate="Subject" display="Dynamic" CssClass="valid"
      validationexpression="^([1-zA-Z0-1@.,\s]{1,40})$"></asp:regularexpressionvalidator>
	  </asp:label>
	  
	  </div>

      <div class="commentsfield">

      <asp:label runat="server" accesskey="6"
	  AssociatedControlID="Comments">Message:<span class="red">*</span>      
      <asp:textbox id="Comments" rows="5" runat="server"
      textmode="MultiLine" accesskey="/" tabindex="305" ToolTip="Enter Your Message Here." />
      <asp:requiredfieldvalidator id="RequiredFieldValidator6" runat="server"
      errormessage="Message: &nbsp; Please enter your comments using alphanumeric characters, only." 
      controltovalidate="Comments" display="Dynamic" CssClass="valid"></asp:requiredfieldvalidator>
      <asp:regularexpressionvalidator id="RegularExpressionValidator6" runat="server" 
	  errormessage="Message: &nbsp; Please limit your text to alphanumeric characters, only, with limited use of punctuation supported."
      controltovalidate="Comments" display="Dynamic" CssClass="valid"
      validationexpression="^([1-zA-Z0-1@.,$%\s]{1,500})$"></asp:regularexpressionvalidator>
	  </asp:label>
     
      </div>
	  
	  <div class="buttons">

      <asp:button onclick="btnSubmit_Click" onkeydown="btnSubmit_Click"
      id="fbutton" accesskey="7" tabindex="306"
      title="Press to Submit Your e-Mail Thank you!."
      runat="server" text="Submit"></asp:button><span class="white">.</span>
      <input type="reset" value="Reset" id="rbutton" runat="server" onkeydown="reset" onclick="reset"
      title="Press to Clear the Form. Thank you!" accesskey="8" tabindex="307" />
	  
	  </div>

      </asp:panel>

      </form>

THE WEB CONFIG FILE

The web.config file includes the appropriate parameter so that NET Framework v2.0 will render ASP.NET controls without the use of tables and the use of the 'name' attribute.

The adjusted code within the web.config file to accomplish this is:

<xhtmlConformance mode="Strict" />

THE ISSUE

The W3C Validation Service is rendering code differently.  Primarily, the 'name' attribute is being tossed in and the three hidden input fields are not being placed within container tags.  This occurs regardless of MIME type specified.

The source code within all test browsers and within both the testing and production environment is valid XHMTL v1.1 and validates to the DTD spec.

The W3C Validation Service will fail the Web content for use in the 'name' attribute and for the 3 input fields not being wrapped in appropriate container tags. It is doing this because it is rendering code differently.

Additionally, all code passes as valid using the following:

1. HTML Tidy
2. CSE HTML Validator
3. Hiawatha Software AccRepair DC 2005
4. Watchfire WebQA

Again, the W3C Validation is failing the content to XHTML v1.1.  Why is the Validation Service rendering content differently than everyone else?

Sincerely,

Craig Thacker
CPRG Limited
www.cprgltd.com
mailto:craig@cprgltd.com
Comment 1 Craig Thacker 2006-09-16 20:08:08 UTC
After much research, this is not a bug on the part of the W3C Validation Service.

ASP.NET and .NET Framework v2.0 and v3.0 RC1 does not include the Validation Service engine in their recognized browsers and the rendered code gets 'downleveled' when rendered.

This produces the errors in code that is sent to the Validation Service engine thus causing the code not to validate.

A workaround is presented in the Microsoft Developer's Library at:

http://msdn2.microsoft.com/en-us/library/exc57y7e.aspx

The workaround entails creating a folder labeled App_Browsers within the root directory and adding a simple text file labeled [anything].browser.  I created a file and labeled it, W3C.browser.

Within the text file, add the following:

<browsers>
  <browser id="W3C_Validator" parentID="default">
    <identification>
        <userAgent match="^W3C_Validator" />
    </identification>
    <capabilities>
      <capability name="browser"              value="W3C Validator" />
      <capability name="ecmaScriptVersion"    value="1.2" />
      <capability name="javascript"           value="true" />
      <capability name="supportsCss"          value="true" />
      <capability name="tables"               value="true" />
      <capability name="tagWriter"          value="System.Web.UI.HtmlTextWriter" />
      <capability name="w3cdomversion"        value="1.0" />
    </capabilities>
  </browser>
</browsers>

Save the file and upload the folder and the file to the root directory of your production server/hosting company.

It is hoped, that the Validation Service will consider adding this fix to their Help and FAQ section.

Sincerely,

C. Thacker
CPRG Limited
Comment 2 Olivier Thereaux 2007-12-07 00:29:38 UTC
*** Bug 5304 has been marked as a duplicate of this bug. ***
Comment 3 Olivier Thereaux 2008-02-16 02:00:43 UTC
*** Bug 5484 has been marked as a duplicate of this bug. ***
Comment 4 Olivier Thereaux 2008-09-23 12:05:35 UTC
*** Bug 6108 has been marked as a duplicate of this bug. ***
Comment 5 Olivier Thereaux 2008-11-23 03:41:24 UTC
*** Bug 6246 has been marked as a duplicate of this bug. ***