Adding meta tag programmatically in C#

后端 未结 10 1181
渐次进展
渐次进展 2020-12-14 01:24

I\'m trying to programmatically add a . It is working fine when there is a Head element with runat = \"server\" in the

10条回答
  •  余生分开走
    2020-12-14 01:28

    You could define your meta tag as a static string like so:

    Private Shared MetaLanguage As String =
        String.Format("", CultureInfo.CurrentUICulture.TwoLetterISOLanguageName)
    

    Then place them in your head like so:

    
        <%=MetaLanguage%>
    
    

    This allow you to use any meta tag values and is easy to read and customize. Note: The use of the Shared keyword (static) helps improve performance.

提交回复
热议问题