Well that works but I think it's generally poor design to have any metadata
collection require instantiation. I know there is some hocus-pocus going on
in the background to build the temporary assemblies that support ASP.NET,
but I don't think it could have been too much of a stretch to have included
the meta tags as attributes in the created types that populate the ASP
namespace.
I was considering helping a client maintain their own metadata more easily
by just letting them alter meta tags on the pages themselves. But having to
instantiate each class to do something like collect metadata for all pages
just isn't going to fly. I'll have to use real attributes on the underlying
vb classes, and alteration of metadata will require editing the code itself
and a recompile, or perhaps I'll store it in SQL Server using a loose data
model if I don't consider that overkill for this particular project.
Paul
"Joe" <Jo*@discussions.microsoft.com> wrote in message
news:BD**********************************@microsof t.com...
this is how i did it
first make class that inherits from page
---------------------------------------------
using System.Text;
using System.Web.UI;
using System.IO;
namespace WebPageBase
{
public class PageBase : System.Web.UI.Page
{
protected System.Web.UI.HtmlControls.HtmlGenericControl alsideKeywords;
public string alsideKey
{
get
{
return alsideKeywords.Attributes["content"].ToString();
}
set
{
alsideKeywords.Attributes["content"] = value;
}
}
then make your meta tags "runat=server"
-------------------------------------------------
<meta name="keywords" id="alsideKeywords" content="Windows Siding"
runat="server"/>
make sure your page inherits from the new class and access like this
-------------------------------------------------------------------------------
// dr is a datareader
//sets keywords
if(dr["keywords"] != DBNull.Value)
((WebPageBase.PageBase)Page).alsideKey = dr["keywords"].ToString();
else ((WebPageBase.PageBase)Page).alsideKey = "Alside - Windows and
Siding";
HTH.......
Joe
"PJ6" wrote:
Can't find anywhere in the docs that mentions a way to programmatically
get
a page's meta tag collection. Reflection finds nothing in attributes.
Can't
find anything in a page instance, either. Are they not accessible?
Paul