Html 4.01 strict instead of xhtml?

Discussion in 'ASP .Net' started by Andy Bell, Aug 7, 2007.

  1. Andy Bell

    Andy Bell Guest

    Can I stop asp.net from applying self closing tags? I am trying to generate
    an html 4.01 strict page rather than an xhtml page and the w3 validator is
    unhappy about asp.net automatically translating this:

    <link rel="stylesheet" href="SkinStyle.aspx?SkinName=Test" type="text/css">

    to this:

    <link rel="stylesheet" href="SkinStyle.aspx?SkinName=Test" type="text/css"
    />
     
    Andy Bell, Aug 7, 2007
    #1
    1. Advertising

  2. Hi Andy,

    Regarding on the ASP.NET/VS IDE html formatting question you mentioned
    they're actually controlled by the HTML Designer's formatting and
    validation setting. You can configure them through the following approaches:

    For the automatically close tag behavior, you can set it through the below
    steps:

    **open "tools ---> options" menu,

    ** in the opened dialog, choose the following path in left view:

    Text Editor-->HTML-->Format-->

    and you'll find the "Auto Insert close Tag" check option

    for the design-time validation(against html), you can also find the
    following setting:

    Text Editor-->HTML-->Validation ---> "Target:"

    you can choose "HTML 4.01" as your ASPX page's target validation
    schema(instead of xhtml 1.0)

    Hope this helps.

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead



    ==================================================

    Get notification to my posts through email? Please refer to
    http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
    ications.



    Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
    where an initial response from the community or a Microsoft Support
    Engineer within 1 business day is acceptable. Please note that each follow
    up response may take approximately 2 business days as the support
    professional working with you may need further investigation to reach the
    most efficient resolution. The offering is not appropriate for situations
    that require urgent, real-time or phone-based interactions or complex
    project analysis and dump analysis issues. Issues of this nature are best
    handled working with a dedicated Microsoft Support Engineer by contacting
    Microsoft Customer Support Services (CSS) at
    http://msdn.microsoft.com/subscriptions/support/default.aspx.

    ==================================================


    This posting is provided "AS IS" with no warranties, and confers no rights.
     
    Steven Cheng[MSFT], Aug 7, 2007
    #2
    1. Advertising

  3. Andy Bell

    Andy Bell Guest

    Steven Cheng[MSFT] wrote:
    > Hi Andy,
    >
    > Regarding on the ASP.NET/VS IDE html formatting question you mentioned
    > they're actually controlled by the HTML Designer's formatting and
    > validation setting. You can configure them through the following
    > approaches:
    >
    > For the automatically close tag behavior, you can set it through the
    > below steps:
    >
    > **open "tools ---> options" menu,
    >
    > ** in the opened dialog, choose the following path in left view:
    >
    > Text Editor-->HTML-->Format-->
    >
    > and you'll find the "Auto Insert close Tag" check option


    Hi, thanks for your help! I just tried this but it didn't make a difference.
    The tag doesn't have self closing tags in the designer, only in the
    outputted html.
     
    Andy Bell, Aug 7, 2007
    #3
  4. Hi Andy,

    Thanks for your reply and the further clarify.

    Actually, I originally assume that you just want to change the edit
    experience in IDE at design-time. So you also want the runtime html output
    be formated without close tag ( "/>"), right?

    I've performed some further test, actually, ASP.NET 2.0 runtime can let you
    specify the "xhtmlConformance" to a "Legacy" value so that the output will
    conform to ASP.NET 1.1 format, e.g.

    ===========
    ............
    <xhtmlConformance mode="Legacy"/>
    </system.web>
    ============

    However, when running the aspx page, such as below:

    ============
    <html >
    <head runat="server">
    <link rel="stylesheet" href="SkinStyle.aspx?SkinName=Test" type="text/css">

    <title>Untitled Page</title>
    </head>
    <body>
    <form id="form1" runat="server">
    <div>
    <input type="button" >

    </div>
    </form>
    </body>
    </html>
    ==============

    the <input type="button" > can be keep without close tag, the <link ....>
    will be formated to <link .... />. It seems the runtime engine will
    transalte the tags in <head> section and ensure closing tag and there
    hasn't any declarative means to configure this.

    So far I think one way to overcome this behavior would be manually
    customize the ASP.NET page's response output through a Response Filter
    stream. You can attach a Filter for each Page's Response and modify the
    response content. Here is a web article demonstrate using response Filter
    to customize(format) page output:

    http://aspnetresources.com/articles/HttpFilters.aspx
    Producing XHTML-Compliant Pages With Response Filters

    For your scenario, you may use it to change all the "/>" close tag to ">".

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead


    This posting is provided "AS IS" with no warranties, and confers no rights.
     
    Steven Cheng[MSFT], Aug 8, 2007
    #4
  5. Andy Bell

    Andy Bell Guest

    Steven Cheng[MSFT] wrote:
    > So far I think one way to overcome this behavior would be manually
    > customize the ASP.NET page's response output through a Response Filter
    > stream. You can attach a Filter for each Page's Response and modify
    > the response content. Here is a web article demonstrate using
    > response Filter to customize(format) page output:
    >
    > http://aspnetresources.com/articles/HttpFilters.aspx
    > Producing XHTML-Compliant Pages With Response Filters
    >
    > For your scenario, you may use it to change all the "/>" close tag to
    > ">".


    Perfect, thank you!
     
    Andy Bell, Aug 8, 2007
    #5
  6. You're welcome :)

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead
     
    Steven Cheng[MSFT], Aug 8, 2007
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Peter L.
    Replies:
    0
    Views:
    347
    Peter L.
    Oct 20, 2003
  2. Rob Roberts
    Replies:
    5
    Views:
    2,840
    Rob Roberts
    Jan 20, 2006
  3. Christopher R

    xhtml strict is being very stict why?

    Christopher R, Oct 1, 2003, in forum: HTML
    Replies:
    13
    Views:
    829
  4. xhtml champs
    Replies:
    0
    Views:
    567
    xhtml champs
    Aug 1, 2011
  5. xhtml champs
    Replies:
    0
    Views:
    1,083
    xhtml champs
    Aug 2, 2011
Loading...

Share This Page