Change Page Title and Meta Tags using Code behind.

Submitted by planetsourcecode on
One of the good things about the asp.net is that we can make everything accessible at runtime.Same can be done with Page title and the Meta Tags. Simply add Runat="server" to the html tag to make it accessible at run time like below For title Initial Title Here For Meta Tags In the code Behind file: 1). Add the namespace using system.Web.UI.HTMLControls 2). Add the following code in "OnLoad" event title.InnerText = "Initial Title Here" keywords.Attributes("content") = "Initial,keywords,here" description.Attributes("content") = "This is the initial text for description meta tag" save the change and load the page in browser and simply check the source codes of the web page. About the author: Planet Source Code is a place for all developer providing free source codes, articles, complete projects,complete application in PHP, C/C++, Javascript, Visual Basic, Cobol, Pascal, ASP/VBScript, AJAX, SQL, Perl, Python, Ruby, Mobile Development