Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Re: how do I get a page's meta tag contents?

Thread Tools

Re: how do I get a page's meta tag contents?

Posts: n/a
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

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.


"Joe" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Meta-Meta-Programming, revisited Erik Veenstra Ruby 21 07-25-2006 10:26 PM
Meta-Meta-Programming Erik Veenstra Ruby 29 02-08-2006 08:22 PM
how do u invoke Tag b's Tag Handler from within Tag a's tag Handler? shruds Java 1 01-27-2006 03:00 AM
Meta methods to govern meta data? Duane Johnson Ruby 6 10-28-2005 03:57 AM
META NAME and META HTTP-EQUIV Nym Pseudo HTML 1 09-26-2003 09:13 AM