C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » C# Syntax »

Changing Dynamically allocate Title, Meta Keywords and Meta description in to a Page


Posted Date: 29 Oct 2009    Resource Type: Code Snippets    Category: C# Syntax
Author: Gopal Singh RathoreMember Level: Silver    
Rating: 1 out of 5Points: 4



First Assign a id in header section of a Master file like

<head runat="server" id="main-Master-Header" />


Now to Access the id of Main Master page in any page at the page load event like

HtmlHead hdMain = (HtmlHead)Page.Master.FindControl("main-Master-Header");

Now Creating the object of HTMLMETA

HtmlMeta htmMeta= new HtmlMeta();


Then assign the type of meta tag to the variable and content also... like

htmMeta.Attributes.Add("name","description");
htmMeta.Attributes.Add("content", "Cornerstone REO Services provides a wide variety of Asset Management Services to valued clientele by
creating peer to peer, first generation relationships, to assist them in the timely, systematic solution to their REO management needs. Our service area encompasses all 21 New Jersey Counties.");


Now Adding the Meta Tag in the Header Section... like


hdMain.Controls.Add(htmMeta);
//Adding keyword Meta Tag to Head Section
HtmlMeta hm2 = new HtmlMeta();
hm2.Attributes.Add("name", "keywords");
hm2.Attributes.Add("content", "REO Services, Asset Management, New Jersey Counties");
hdMain.Controls.Add(hm2);

//Adding title Tag in the Header Section... like

HtmlMeta titleHTMLMeta = new HtmlMeta();
titleHTMLMeta.Attributes.Add("name","title");
titleHTMLMeta.Attributes.Add("Content", "REO Services, Asset Management, New Jersey Counties Cornerstone");
hdMain.Controls.Add(titleHTMLMeta);


Attachments

  • Changing Dynamically allocate Title, Meta Keywords and Meta description in to a Page (34490-291727-Code-for-Adding-Meta-Keywords-and-Description-to-Site-in-C-Sharp.txt)


  • Responses


    No responses found. Be the first to respond and make money from revenue sharing program.

    Feedbacks      
    Popular Tags   What are tags ?   Search Tags  
    Sign In to add tags.
    Meta Keywords and Meta description in to a Page Using Master Page at the Same Time in C#  .  Changing Dynamically allocate Title  .  

    Post Feedback


    This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
    You must Sign In to post a response.
    Next Resource: Encryption and Decryption in C#
    Previous Resource: Using winAPI in .NET Program
    Return to Discussion Resource Index
    Post New Resource
    Category: C# Syntax


    Post resources and earn money!
     
    More Resources



    dotNet Slackers

    About Us    Contact Us    Privacy Policy    Terms Of Use