如何取回在一个页面自定义meta标签? [英] How do I retrieve a custom meta tag in a page?

查看:149
本文介绍了如何取回在一个页面自定义meta标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下的code:

List<HtmlMeta> metas = new List<HtmlMeta>();
foreach (Control c in this.Page.Header.Controls)
    if (c.GetType() == typeof(HtmlMeta))
    {
        HtmlMeta meta = (HtmlMeta)c;
        if (meta.Name == "CategoryID")
            strMeta = meta.Content;
    }

我创建这个自定义meta标签:

I created this custom meta tag:

<meta id ="CategoryID" name="CategoryID" content="35" />

我在code步骤,并在如果突破(meta.Name ==类别ID)

它得到的meta标签在此之前然后显示meta.name =然后退出循环。它从来没有看到我的自定义meta标签。

It gets to the meta tag before this then shows meta.name ="" then exits loop. It never sees my custom meta tag.

此人之前的标签是:&LT; META NAME =验证-V1CONTENT =AtroutoUUTAiOHzlmZOap4a5YdzOByK5v9bzwpzPy60 =/&GT;

现在你可能会问,为什么我会做到这一点。我使用的DotNetNuke的CMS,我需要为最终用户将在需要在后端code的查询参数的方式。我似乎无法把任何东西的网址,如查询字符串关闭链接到页面,所以我尝试了meta标签,因为它们可以在页面(标签)的DNN的设置中添加这一点。

Now you may ask why would I do this. I am using DotNetNuke CMS, I need a way for the end user to put in a parameter needed for a query in the backend code. I cannot seem to put anything in the url , like a querystring off the link to get to the page, so I tried a meta tag, as they can add this in the settings of the page(tab) in dnn.

我已经试过离开了ID的标签,只是名字,但同样的问题。

I have tried leaving out id in the tag and just name, but same issue.

我要寻找FORR一个简单的和非资源紧张的解决方案。

I am looking forr a simple and non resource intense solution.

任何有识之士这还是在DNN或ASP.net解决办法将是巨大的。

Any insight to this or workaround in dnn or ASP.net would be great.

先谢谢了。

推荐答案

我的解决办法工作,它是的网页在DotNetNuke的渲染过程。

My solution does work, it is the process of how the page is rendered in DotNetNuke.

这篇关于如何取回在一个页面自定义meta标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆