If you want to use code behind remove that og:title meta tag and put runat="server" in head tag.
in markup :
<head runat="server">
...
</head>
and code behind:
HtmlMeta tag = new HtmlMeta();
tag.Name = "og:title";
tag.Content = GetSocialTitle();
Page.Header.Controls.Add(tag);
If you don't want to use code behind, remove runat server from head tag :
<head>
<meta name="og:title" content="<%= GetSocialTitle() %>"/>
...
</head>
No more Meta Refresh Tags
From time to time I have pages that need to auto-refresh or more commonly a page that automatically needs to go to another page after showing a short informational message. In the past I’ve always done this with Meta-Refresh tags in the page which looks like this:
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>
Welcome Back
title>
<meta http-equiv="Refresh" content="2; URL=/wwstore/Profile.aspx" />
head>
You can add this into an ASP.NET page with code like this:
// *** Create META tag and add to header controls
HtmlMeta RedirectMetaTag = new HtmlMeta();
RedirectMetaTag.HttpEquiv = "Refresh";
RedirectMetaTag.Content = string.Format("{0}; URL={1}", this.Context.Items["ErrorMessage_Timeout"], NewUrl);
this.Header.Controls.Add(RedirectMetaTag);
But I never put 2 and 2 together to realize that the meta tag is actually mapping an HTTP header. A much easier way to do this is to simply add a header:
Response.AppendHeader("Refresh", "4");
Or refresh and go off to another page:
Response.AppendHeader("Refresh", "4; url=profile.aspx");
Duh… much cleaner. One advantage of the Meta tag approach is that if somebody bookmarks the page the Meta-Refresh will still fire even on a page that is browser cached, while the HTTP header most likely wouldn’t.
Ah, the little obvious things one overlooks sometimes…
No comments:
Post a Comment
If any doubt?then please comment in my post