How to add meta tag to ASP.Net content page

前端 未结 6 1455
后悔当初
后悔当初 2020-12-08 05:01

I have several content pages hanging off of one master page. I need to add a refresh meta tag to one of the content pages but I can\'t see where I can do this.

Any

6条回答
  •  余生分开走
    2020-12-08 05:43

    This page explains the new feature: ASP.Net 4 adds 2 new Meta tag related properties to the Page. They can be used to set meta tags for keywords and description.

    You can set them in the code behind:

    Page.MetaKeywords = "keyword1, keyword2, keyword3";
    Page.MetaDescription = "Example of new meta tag support in ASP.Net 4";
    

    You can also set in the @Page directive:

    <%@ Page Language="C#" AutoEventWireup="true"
    MetaKeywords="keyword1, keyword2, keyword3"
    MetaDescription="Example of new meta tag support in ASP.Net 4"
    CodeFile="Default.aspx.cs" Inherits="_Default" %>
    

    The ouput of either of these methods renders html similar to the following:

    
    
    
        
            ASP.NET 4 Meta Tag Support
        
        
        
    
    
    
    
    

提交回复
热议问题