本文整理汇总了C#中System.Web.UI.HtmlControls.HtmlMeta类的典型用法代码示例。如果您正苦于以下问题:C# HtmlMeta类的具体用法?C# HtmlMeta怎么用?C# HtmlMeta使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HtmlMeta类属于System.Web.UI.HtmlControls命名空间,在下文中一共展示了HtmlMeta类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: lbkUnDisable_Click
protected void lbkUnDisable_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(ddlUsers.SelectedValue))
{
if (Membership.GetUser(ddlUsers.SelectedValue).IsApproved == false)
{
MembershipUser user = Membership.GetUser(ddlUsers.SelectedValue);
user.IsApproved = true;
Membership.UpdateUser(user);
if (Membership.GetUser(ddlUsers.SelectedValue).IsApproved == true)
{
HtmlMeta meta = new HtmlMeta();
meta.HttpEquiv = "Refresh";
meta.Content = "2;url=ManageUser.aspx";
this.Page.Controls.Add(meta);
lblComment.Text = "<h4 style='color:green'>User " + ddlUsers.SelectedItem.Text + "'s account is now Undisabled</h4><br/><br/>You will now be redirected in 5 seconds";
}
}
else
{
lblComment.Text = "<h4 style='color:green'>User " + ddlUsers.SelectedItem.Text + "'s account is not Disabled.</h4>";
}
}
else
{
lblComment.Text = "<h4 style='color:red'>Please Select a User to Undisable</h4>";
}
}
示例2: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
User loggedUser = UserOpr.isLogged(Request);
if (loggedUser == null)
{
LoginStatus.Text = "您未登录或登录过期,请重新登录,3秒后跳转到用户登录页面";
LoginStatus.Visible = true;
HtmlMeta RedirectMeta = new HtmlMeta(); //重定向用Meta标签
RedirectMeta.HttpEquiv = "refresh"; //指定行为为跳转
RedirectMeta.Content = "3;url=" + ReadWebConfig.GetAppSettingValue("LoginPageURL"); //时间为三秒,跳转到首页
this.Page.Header.Controls.Add(RedirectMeta);
}
else
{
if (!Page.IsPostBack)
{
if (loggedUser.User_isChecked)
{
//已激活
LoginStatus.Text = "您已经完成用户激活,无需再次激活";
LoginStatus.Visible = true;
}
else
{
//未激活
UserOpr.SendVerifyMailToNewUser(loggedUser);
LoginStatus.Text = "确认信已经发往您登录时所用邮箱,请查收";
LoginStatus.Visible = true;
}
}
}
}
示例3: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
var _configs = cf.Config_meta();
if (_configs.ToList().Count > 0)
{
if (!string.IsNullOrEmpty(_configs.ToList()[0].CONFIG_FAVICON))
ltrFavicon.Text = "<link rel='shortcut icon' href='" + PathFiles.GetPathConfigs() + _configs.ToList()[0].CONFIG_FAVICON + "' />";
}
HtmlHead header = base.Header;
HtmlMeta headerDes = new HtmlMeta();
HtmlMeta headerKey = new HtmlMeta();
headerDes.Name = "Description";
headerKey.Name = "Keywords";
header.Title = "Đăng ký đại lý";
if (!IsPostBack)
{
Load_city();
Load_distric(-1);
loadYear();
loadMonth();
loadDay();
}
}
示例4: InitializePage
public void InitializePage(string _title, string _description, string _keywords, bool allowRobots)
{
string title = "cspad - C# pastebin and code snippets";
title = title.Substring(0, 1).ToUpper() + title.Substring(1);
Page.Title = title;
HtmlMeta keywords = new HtmlMeta();
keywords.Name = "keywords";
keywords.Content = HttpUtility.HtmlAttributeEncode(_keywords) + "," +
"C#, C Sharp, code, programming, visual studio, snippets, source code";
HtmlMeta description = new HtmlMeta();
description.Name = "description";
description.Content = _description == null ? "" : HttpUtility.HtmlAttributeEncode(_description);
HeadPlaceHolder.Controls.AddAt(0, description);
HeadPlaceHolder.Controls.AddAt(1, keywords);
if (!allowRobots)
{
//<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
HtmlMeta robots = new HtmlMeta();
description.Name = "robots";
description.Content = "NOINDEX, FOLLOW";
HeadPlaceHolder.Controls.AddAt(2, description);
}
}
示例5: OnPreRender
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
//if(!string.IsNullOrEmpty(Name) && !string.IsNullOrEmpty(Content))
//{
// var metaTag = new HtmlMeta();
// metaTag.Name = Name;
// metaTag.Content = Content;
// Page.Header.Controls.Add(metaTag);
//}
if ((!string.IsNullOrEmpty(Name) || !string.IsNullOrEmpty(HttpEquiv)) && !string.IsNullOrEmpty(Content))
{
var metaTag = new HtmlMeta();
if (!string.IsNullOrEmpty(HttpEquiv))
metaTag.HttpEquiv = HttpEquiv;
if (!string.IsNullOrEmpty(Name))
metaTag.Name = Name;
metaTag.Content = Content;
if (InsertFirst)
Page.Header.Controls.AddAt(0, metaTag);
else
Page.Header.Controls.Add(metaTag);
}
}
示例6: UpdataMetagMainTitle
public static void UpdataMetagMainTitle(System.Web.UI.Control PageView, string title)
{
if (title.Trim() == "")
title = ConfigurationManager.AppSettings["title"];
else
title = title + " | " + ConfigurationManager.AppSettings["title"];
PageView.Page.Title = title;
HtmlMeta tagAuthor = new HtmlMeta();
tagAuthor.Attributes.Add("name", "author");
tagAuthor.Content = ConfigurationManager.AppSettings["author"];
PageView.Page.Header.Controls.Add(tagAuthor);
HtmlMeta tagKeywords = new HtmlMeta();
tagKeywords.Attributes.Add("name", "Keywords");
tagKeywords.Content = ConfigurationManager.AppSettings["keywords"];
PageView.Page.Header.Controls.Add(tagKeywords);
HtmlMeta tagDescription = new HtmlMeta();
tagDescription.Attributes.Add("name", "description");
tagDescription.Content = ConfigurationManager.AppSettings["description"];
PageView.Page.Header.Controls.Add(tagDescription);
HtmlMeta tagImage = new HtmlMeta();
tagImage.Attributes.Add("name", "image");
tagImage.Content = ConfigurationManager.AppSettings["image"];
PageView.Page.Header.Controls.Add(tagImage);
}
示例7: Bind_meta_tags_cat
public void Bind_meta_tags_cat()
{
#region Bind Meta Tags
HtmlHead header = base.Header;
HtmlMeta headerDes = new HtmlMeta();
HtmlMeta headerKey = new HtmlMeta();
//Face tags
HtmlMeta propety = new HtmlMeta();
HtmlMeta propetyTitle = new HtmlMeta();
HtmlMeta propetyDesc = new HtmlMeta();
//Twitter tags
HtmlMeta propetyTw = new HtmlMeta();
HtmlMeta propetyTitleTw = new HtmlMeta();
HtmlMeta propetyDescTw = new HtmlMeta();
headerDes.Name = "Description";
headerKey.Name = "Keywords";
header.Title = Utils.CStrDef(Session["Cat_seo_title"]);
headerDes.Content = Utils.CStrDef(Session["Cat_seo_desc"]);
headerKey.Content = Utils.CStrDef(Session["Cat_seo_keyword"]);
if (string.IsNullOrEmpty(headerDes.Content))
{
headerDes.Content = "";
}
header.Controls.Add(headerDes);
if (string.IsNullOrEmpty(headerKey.Content))
{
headerKey.Content = "";
}
header.Controls.Add(headerKey);
//Facebook meta
propety.Attributes.Add("property", "og:image");
propety.Content = "" + System.Configuration.ConfigurationManager.AppSettings["URLWebsite"] + "" + PathFiles.GetPathCategory(Utils.CIntDef(Session["Cat_id"])) + Utils.CStrDef(Session["Cat_image1"]);
header.Controls.Add(propety);
//Title
propetyTitle.Attributes.Add("property", "og:title");
propetyTitle.Content = Utils.CStrDef(Session["Cat_seo_title"]);
header.Controls.Add(propetyTitle);
//Desc
propetyDesc.Attributes.Add("property", "og:description");
propetyDesc.Content = Utils.CStrDef(Session["Cat_seo_desc"]);
header.Controls.Add(propetyDesc);
//Twitter meta
propetyTw.Attributes.Add("property", "twitter:image");
propetyTw.Content = "" + System.Configuration.ConfigurationManager.AppSettings["URLWebsite"] + "" + PathFiles.GetPathCategory(Utils.CIntDef(Session["Cat_id"])) + Utils.CStrDef(Session["Cat_image1"]);
header.Controls.Add(propetyTw);
//Title
propetyTitleTw.Attributes.Add("property", "twitter:title");
propetyTitleTw.Content = Utils.CStrDef(Session["Cat_seo_desc"]);
header.Controls.Add(propetyTitleTw);
//Desc
propetyDescTw.Attributes.Add("property", "twitter:description");
propetyDescTw.Content = Utils.CStrDef(Session["Cat_seo_desc"]);
header.Controls.Add(propetyDescTw);
#endregion
}
示例8: Bind_meta_tags_news
public void Bind_meta_tags_news()
{
#region Bind Meta Tags
HtmlHead header = base.Header;
HtmlMeta headerDes = new HtmlMeta();
HtmlMeta headerKey = new HtmlMeta();
HtmlMeta propety = new HtmlMeta();
headerDes.Name = "Description";
headerKey.Name = "Keywords";
header.Title = Utils.CStrDef(Session["News_seo_title"]);
headerDes.Content = Utils.CStrDef(Session["News_seo_desc"]);
headerKey.Content = Utils.CStrDef(Session["News_seo_keyword"]);
propety.Attributes.Add("property", "og:image");
propety.Content = "caodangngheytebinhduong" + PathFiles.GetPathNews(Utils.CIntDef(Session["News_id"])) + Utils.CStrDef(Session["News_image3"]);
header.Controls.Add(propety);
if (string.IsNullOrEmpty(headerDes.Content))
{
headerDes.Content = "";
}
header.Controls.Add(headerDes);
if (string.IsNullOrEmpty(headerKey.Content))
{
headerKey.Content = "";
}
header.Controls.Add(headerKey);
#endregion
}
示例9: Bind_meta_tags_cat
public void Bind_meta_tags_cat()
{
#region Bind Meta Tags
HtmlHead header = base.Header;
HtmlMeta headerDes = new HtmlMeta();
HtmlMeta headerKey = new HtmlMeta();
headerDes.Name = "Description";
headerKey.Name = "Keywords";
header.Title = Utils.CStrDef(Session["Cat_seo_title"]);
headerDes.Content = Utils.CStrDef(Session["Cat_seo_desc"]);
headerKey.Content = Utils.CStrDef(Session["Cat_seo_keyword"]);
if (string.IsNullOrEmpty(headerDes.Content))
{
headerDes.Content = "";
}
header.Controls.Add(headerDes);
if (string.IsNullOrEmpty(headerKey.Content))
{
headerKey.Content = "";
}
header.Controls.Add(headerKey);
#endregion
}
示例10: AddMeta
/// <summary>
/// 添加Meta标签
/// </summary>
/// <param name="page">页面</param>
/// <param name="name">Meta名字</param>
/// <param name="content">Meta内容</param>
public void AddMeta(System.Web.UI.Page page, string name, string content)
{
HtmlMeta meta = new HtmlMeta();
meta.Name = name;
meta.Content = content;
page.Header.Controls.Add(meta);
}
示例11: getKeywords
public static string getKeywords(string strHTMLCode)
{
Regex metaregex = new Regex(@"<meta\s*(?:(?:\b(\w|-)+\b\s*(?:=\s*(?:""[^""]*""|'" +
@"[^']*'|[^""'<> ]+)\s*)?)*)/?\s*>", RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture);
List<HtmlMeta> MetaList = new List<HtmlMeta>();
foreach (Match metamatch in metaregex.Matches(strHTMLCode))
{
HtmlMeta mymeta = new HtmlMeta();
Regex submetaregex = new Regex(@"(?<name>\b(\w|-)+\b)\" +
@"s*=\s*(""(?<value>" +
@"[^""]*)""|'(?<value>[^']*)'" +
@"|(?<value>[^""'<> ]+)\s*)+",
RegexOptions.IgnoreCase |
RegexOptions.ExplicitCapture);
foreach (Match submetamatch in submetaregex.Matches(metamatch.Value.ToString()))
{
if (submetamatch.Groups["value"].ToString().ToLower() == "keywords")
{
//System.Windows.Forms.MessageBox.Show(submetamatch.NextMatch().Groups["value"].ToString().ToLower());
//System.Windows.Forms.MessageBox.Show(submetamatch.Groups["value"].ToString().ToLower());
//File.WriteAllText(Directory.GetCurrentDirectory() + "\\WebSource.txt", submetamatch.Groups["value"].ToString());
return submetamatch.NextMatch().Groups["value"].ToString();
}
}
}
return "";
}
示例12: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
//Add meta info
HtmlMeta meta1;
meta1 = new HtmlMeta();
meta1.Name = "robots";
meta1.Content = "noindex, nofollow";
Page.Header.Controls.Add(meta1);
Page.Header.Controls.Add(new LiteralControl("\n"));
//Show test label if organic link referer
//Set session variable based on referer
string useragentstring = "";
if (Request.ServerVariables["HTTP_USER_AGENT"] != null)
useragentstring = Request.ServerVariables["HTTP_USER_AGENT"].ToString().ToLower();
Regex regEx_apple = new Regex("ipod|iphone|ipad");
Regex regEx_android = new Regex("android");
if (regEx_apple.Match(useragentstring).Success)
{
Response.Redirect("http://itunes.apple.com/us/app/best-pick-reports/id494057962?mt=8");
}
if (regEx_android.Match(useragentstring).Success)
{
Response.Redirect("https://play.google.com/store/apps/details?id=com.brotherfish");
}
}
示例13: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
HtmlHead header = base.Header;
HtmlMeta headerDes = new HtmlMeta();
HtmlMeta headerKey = new HtmlMeta();
headerDes.Name = "Description";
headerKey.Name = "Keywords";
var _configs = cf.Config_meta();
if (_configs.ToList().Count > 0)
{
if (!string.IsNullOrEmpty(_configs.ToList()[0].CONFIG_FAVICON))
ltrFavicon.Text = "<link rel='shortcut icon' href='" + PathFiles.GetPathConfigs() + _configs.ToList()[0].CONFIG_FAVICON + "' />";
header.Title = "Giới thiệu";
headerDes.Content = _configs.ToList()[0].CONFIG_DESCRIPTION;
header.Controls.Add(headerDes);
headerKey.Content = _configs.ToList()[0].CONFIG_KEYWORD;
header.Controls.Add(headerKey);
}
else
{
header.Title = "Enews Standard V1.0";
headerDes.Content = "Enews Standard V1.0";
header.Controls.Add(headerDes);
headerKey.Content = "Enews Standard V1.0";
header.Controls.Add(headerKey);
}
}
示例14: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
_iUserID = Utils.CIntDef(Session["USER_ID"]);
if (_iUserID == 0) Response.Redirect("/");
var _configs = cf.Config_meta();
if (_configs.ToList().Count > 0)
{
if (!string.IsNullOrEmpty(_configs.ToList()[0].CONFIG_FAVICON))
ltrFavicon.Text = "<link rel='shortcut icon' href='" + PathFiles.GetPathConfigs() + _configs.ToList()[0].CONFIG_FAVICON + "' />";
}
HtmlHead header = base.Header;
HtmlMeta headerDes = new HtmlMeta();
HtmlMeta headerKey = new HtmlMeta();
headerDes.Name = "Description";
headerKey.Name = "Keywords";
header.Title = "Thông tin cá nhân";
if (!IsPostBack)
{
Load_city();
Load_distric(-1);
Loaduser_info();
}
}
示例15: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
var _configs = cf.Config_meta();
if (_configs.ToList().Count > 0)
{
if (!string.IsNullOrEmpty(_configs.ToList()[0].CONFIG_FAVICON))
ltrFavicon.Text = "<link rel='shortcut icon' href='" + PathFiles.GetPathConfigs() + _configs.ToList()[0].CONFIG_FAVICON + "' />";
}
HtmlHead header = base.Header;
HtmlMeta headerDes = new HtmlMeta();
HtmlMeta headerKey = new HtmlMeta();
headerDes.Name = "Description";
headerKey.Name = "Keywords";
header.Title = "Thanh toán";
Guid _guid = (Guid)Session["news_guid"];
if (!pay.Check_Cart(_guid))
{
Response.Redirect("/", false);
}
loadBanking();
loadCast();
}