xhtml meta tags

C

chandy

Hi,

I am trying to set meta data in an asp.net 2.0 application. I tried
this:

<meta name="keywords" content="" id="metaKeywords" runat="server" />

with this in the codebehind:

metaKeywords.attributes("content") = "my keywords"

but the html meta tag that this output was like this:

<meta id="_ctl0_Meta1_metaKeywords" name="Keywords" content="my
keywords"></meta>

it no longer terminated with / > and added a closing tag instead!

So instead I tried it all codebehind and used the new HtmlMeta class:

Dim metaKeywords As New HtmlMeta()
metaKeywords.Name = "Keywords"
metaKeywords.Content = "my keywords"
Me.Controls.Add(metaKeywords)

This time it just rendered an old HTML 4.0 tag:

<meta name="Keywords" content="my keywords">

Again not what I want.

So, how do I get asp.net to render an xhtml-compliant meta tag that
ends with /> ?

Thanks,

Chandy
 
C

clintonG

I've been under the impression that when Visual Studio is configured using
XHTML 1.0 Transitional the controls will emit the desired HTML. Do you have
the HTML Source Editing toolbar loaded and have you selected XHTML 1.0
Transitional?

<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://clintongallagher.metromilwaukee.com/
MAP 43°2'17"N 88°2'37"W : 43°2'17"N 88°2'37"W
 
C

chandy

Hi clinton,

Yes I do and yes I have XHTML selected. That only appears to effect
the validation in the IDE though?

Chandy
 
C

chandy

I have it now. You have to put <xhtmlConformance mode="Transitional"/>
in the web.config.

Chandy
 

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

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,125
Latest member
VinayKumar Nevatia_
Top