Mar
24
2013

SEO add meta tags dynamically in ASP.NET C#

Here is an example how to add meta tags such as page title, meta description, and meta keywords in asp.net C#.   namespace reference use: using System.Web.UI.HtmlControls; Add the following code into your (.aspx.cs) page: protected void Page_Load(object sender, EventArgs e) { // set page title Page.Title = "Welcome to Phi's Homepage - PhiBui.com"; //Page description HtmlMeta pagedesc = new HtmlMeta(); pagedesc.Name = "Description"; pagedesc.Content ="Phi Bui is Software Engineer & IT Professional in Louisville KY"; Header.Controls.Add(pagedesc); //page keywords HtmlMeta pagekeywords = new HtmlMeta(); pagekeywords.Name = "keywords"; pagekeywords.Content = "Programmer,ASP.NET,SEO,C#,C/C++,HTML/CSS,JavaScript/JQuery,MS SQL Database,MySQL Database,PostgreSQL"; Header.Controls.Add(pagekeywords); }
Mar
24
2013
SEO

Optimize your websites with the lastest SEO Google Cheatshet

This cheatsheet helps you create SEO friendly and increase visibility to the Search engines.       A quick cheatsheet can be download here: Google-one-page-SEO-Guide.pdf (346.75 kb)     Here is the Google Search Engine Optimization Starter Guide for advanced users: search-engine-optimization-starter-guide.pdf (4.12 mb) Good luck and have fun with it!!!
Mar
21
2013
SEO

How To Remove The HTML White Space in ASP.NET C#

Remove the HTML white space at runtime will reduce the HTML page size so the web page will be loading faster. This method is for SEO purposes. Add the code below to any ASPX.CS page or Master page, then browse the page to see the magic.   using System.Text.RegularExpressions; //BEGIN: Removing HTML white Space. ##################################################################### private static readonly Regex REGEX_BETWEEN_TAGS = new Regex(@">\s+<", RegexOptions.Compiled); private static readonly Regex REGEX_LINE_BREAKS = new Regex(@"\n\s+", RegexOptions.Compiled); protected override void Render(HtmlTextWriter writer) { using (HtmlTextWriter htmlwriter = new HtmlTextWriter(new System.IO.StringWriter())) { base.Render(htmlwriter); string html = htmlwriter.InnerWriter.ToString(); html = REGEX_BETWEEN_TAGS.Replace(html, "> <"); html = REGEX_LINE_BREAKS.Replace(html, string.Empty); writer.Write(html.Trim()); } } //END: Removing HTML white Space. #####################################################################

Calendar

<<  October 2020  >>
MoTuWeThFrSaSu
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678

View posts in large calendar