I use ASP.NET, and I want generate Meta tags for last-modified:
<head>
<meta http-equiv="last-modified" content="2013-10-23@17:23:00 UTC" />
</head>
I use this code in the page:
protected void Page_Load(object sender, EventArgs e)
{
if (this.IsPostBack) return;
// .. and set last modified in the date format specified in the HTTP rfc.
// <meta http-equiv="last-modified" content="2013-10-23@17:23:00 UTC" />
var value = DateTime.Now.ToUniversalTime().ToString("R");
Response.AddHeader("Last-Modified", value);
Response.AppendHeader("Last-Modified", value);
Response.Cache.SetLastModified(DateTime.Now);
}
But nothing generate in the head.
Any suggestions?
I think you are looking for the HtmlMeta
Control.
HtmlMeta hm = new HtmlMeta();
hm.Name = "Last-Modified";
hm.Content = value;
Page.Header.Controls.Add(hm);