2017-09-07 3 views
0

J'utilise ASP.NET, et je veux générer balises Meta pour dernière modification:Générer Meta dernière modification dans ASP.NET

<head> 
<meta http-equiv="last-modified" content="[email protected]:23:00 UTC" /> 
</head> 

J'utilise ce code dans la 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="[email protected]: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); 
    } 

Mais rien ne génère dans la tête .

Des suggestions?

Répondre

1

Je pense que vous recherchez le contrôle HtmlMeta.

HtmlMeta hm = new HtmlMeta(); 
hm.Name = "Last-Modified"; 
hm.Content = value; 
Page.Header.Controls.Add(hm);