No more Metadata collection
In my ASP.NET 2.0 Core Reference book, much of the information on pages 133-135 appears to be incorrect.
In particular, speaking of the HtmlHead control I talk about a Metadata member that is no longer there. To add a new meta tag, you have to create a new HtmlMeta control and add it to the Controls collection of the HtmlHead control. This technique is described in the book as an alternate technique whereas it is in the final version of ASP.NET 2.0 the only viable route.
At a closer inspection, I would say that the team completely changed the implementation of the HtmlHead control, as it does not implement the IPageHeader interface that is also mentioned in the book. Now HtmlHead inherits HtmlGenericControl and exposes a Stylesheet and Title property. Here's the Visual Basic .NET code you need to add a meta tag programmatically:
Private Sub AddPageExitMetaTag()
Dim meta As New HtmlMeta
meta.HttpEquiv = "Page-Exit"
meta.Content = "progid:DXImageTransform.Microsoft.Fade(duration=.4)"
If Not Me.Header Is Nothing Then
Me.Header.Controls.Add(meta)
End If
End Sub
To remove existing meta tags, you should locate them in the Controls collection and remove using the Remove method on the ControlCollection class.
PS: Credits go to Sam for pointing this out.