Author Archive

How-to: 301 Permanent Redirect with ASP.NET 4 – Response.RedirectPermanent()

Friday, July 9th, 2010 by Brent

During the process of migrating development over to the .NET 4 Framework there have been noticeable improvements.

One of the newest improvements is used quite often, Response.RedirectPermanent(). This new feature does a permanent redirection from a requested URL to a specified URL.

For a quick flashback to how this was previously completed review the code below:

/*
 * Previous 301 Permanent Redirect
 * */
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location", "NewPage.aspx");

How you implement the new 301 Permanent Redirect is simply Response.RedirectPermanent(“URL-path-goes-here”). Here is an example with the new way with fewer lines of code.

/*
 * .NET 4 301 Permanent Redirect
 * */
Response.RedirectPermanent("NewPage.aspx");

By implementing 301 redirects it is a good practice to inform search engines that content has moved to a new location. Here are examples where Force 5 is involved with 301 redirects:

  • a web page that have moved
  • a Web page that has been removed
  • web page content that has been consolidated with another web page
  • non-www permanent redirect to the www (or vice versa)

How-to: Adding META Keywords & META Description with ASP.NET 4

Tuesday, July 6th, 2010 by Brent

In a previous post I showed how-to add specific page keywords & descriptions while using ASP.NET with Master Pages. Compared with the latest ASP.NET 4 version, this technique was not coder friendly.

In ASP.NET 4 adding page keywords and descriptions is as easy as this shown below.

    protected void Page_Load(object sender, EventArgs e)
    {
        // page keywords
        Page.MetaKeywords = "keywords go here...";
        // page description
        Page.MetaDescription = "description go here...";
    }

Overall, page keywords & descriptions are still important for SEO success along with page titles and page content. If you need any help with your website search rankings please feel free to contact Force 5 for some guidance.

The little things to not forget about during development [Part: 2]

Friday, May 7th, 2010 by Brent

Sitemap.xml

What are Sitemaps and why are they important?

Sitemaps are a tool for developers to inform search engines about the website content that is available to be indexed. The sitemap protocol is made up of XML that contains a list of URLs, last modified dates, and page priorities for your website.

Here is a quick sample in simple form of a sitemap.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<urlset  xmlns=”http://www.sitemaps.org/schemas/sitemap/0.9”>
  <url>
  <loc>http://www.discoverforce5.com/</loc>
  </url>
  <url>
  <loc>http://www.discoverforce5.com/About/</loc>
  </url>
</urlset>

For more information on sitemap protocol and XML tag definitions visit: http://www.sitemaps.org/protocol.php#xmlTagDefinitions

Below you will see two optional attributes available to include in your sitemap. The new attributes you see will be <changefreq> and <priority>. As stated within the sitemap documentation:

  • <changefreq> refers to how often a page is likely to change even though search engines may not crawl that often.
  • <priority> refers to the priority related to other links/URL’s within your site.
<?xml version="1.0" encoding="UTF-8"?>
<urlset  xmlns=”http://www.sitemaps.org/schemas/sitemap/0.9”>
  <url>
  <loc>http://www.discoverforce5.com/</loc>
  <changefreq>monthly</changefreq>
  <priority>1.00</priority>
  </url>
  <url>
  <loc>http://www.discoverforce5.com/About/</loc>
  <changefreq>monthly</changefreq>
  <priority>0.80</priority>
  </url>
</urlset>

For more information about sitemaps and more advance information head over to www.sitemaps.org.

Next steps – Submitting your sitemap to the search engines

Each search engine is different in how they approach webmasters in submitting sites. Here is a list of locations to submit your sitemap.xml to search engines:

Tying in both the sitemap.xml with robots.txt

In part 1 of this series discussing robots.txt, you can declare the location of your sitemap.xml file for web crawlers/bots. Here is an example what a Robots.txt would look like:

User-agent: *
Allow: /
Sitemap: http://www.yourdomain.com/sitemap.xml

A quick refresher about the syntax above: “User-agent: *” is defining all bots and “Allow: /” is stating index all folders.

If you have multiple sitemaps you can declare them in your Robots.txt file. Here is an example in how to do so:

User-agent: *
Allow: /
Sitemap: http://www.yourdomain.com/sitemap-1.xml
Sitemap: http://www.yourdomain.com/sitemap-2.xml

In conclusion, having a sitemap.xml is not required for successful search engine indexing. Although, at Force 5 we believe it is beneficial when submitting your site to search engines that your site will be properly indexed. A great example is when a new site is going live where older pages may no longer exist in the same location. Even though search engines use other methods on indexing your site, using Sitemaps will in the end help the indexing process.

If you have any SEO needs or questions please give Force 5 a call.

The little things to not forget about during development [Part: 1]

Friday, March 19th, 2010 by Brent

Robots.txt – Telling bots where to go and where not to

What is the robots.txt and why is the robots.txt file important?

The robots.txt file is placed in the root folder of your website. This file instructs search engine bots what can and cannot be indexed. All you need to do is to define some criteria of what can be indexed and what cannot.

Examples:

Below you will see “User-agent: *” which is defining all bots and “Allow: /” is stating index all folders.

User-agent: *
Allow: /

Here is a direct opposite to not allow indexing for all bots.

User-agent: *
Disallow: /

Not allowing indexing for your whole website would probably not be recommended. Although there can be special situations where you would want to block all. For example, if you are working on a ‘beta’ website that you did not want to get index. This would be the situation to use if you were not using an authentication process on the beta site to be able to view the site.

A few years ago when bandwidth was costly I ended up having to create a special rule to block my portfolio image folder. In this example you will see how disallow a folder for all bots.

User-agent: *
Disallow: /images/

For more information regarding robots.txt here are a few resources worth checking out:

Lastly, it should be noted the robots.txt is merely a recommendation than absolute. Meaning a bot can totally ignore the robots.txt rules that you have laid out. So if you have any important content that you need to keep from being indexed, it is a best practice to put login credentials on the folder storing that content to keep it from the bots.

If you need help with your robots or SEO please feel free to give Force 5 a call.

Tutorial: How to add specific page keywords & descriptions while using ASP.NET Master Pages

Friday, October 23rd, 2009 by Brent

One of the most common questions that gets asked when starting out with ASP.NET Master Pages is how to add page specific keywords & descriptions.

For those not familiar with ASP.NET and/or Master Pages is that while using Master Pages the normal HTML tags including META tags are not part of individual pages. The individual ASP.NET pages only refer to content areas called, content place holders. The advantage of using Master Pages is that your site HTML template gets referenced in one area so you are able to make site wide changes to the Master Page instead of making the same changes to every individual web page within the site.

So to add either keywords or a description to your individual page you will need to create an HtmlMeta object as show below.

/* how to code */
protected void Page_Load(object sender, EventArgs e)
{
    // variables
    String sKeywords = String.Empty;
    String sDescription = String.Empty;
 
    // page keywords
    sKeywords = “Place your page keywords and phrases here.”;
 
    // page description
    sDescription = “Place your page description here.”;
 
    // meta tag keywords
    HtmlMeta mKeywords = new HtmlMeta();
    mKeywords.Name = “keywords”;
    mKeywords.Content = sKeywords;
    Header.Controls.Add(mKeywords);
 
    // meta tag description
    HtmlMeta mDescription = new HtmlMeta();
    mDescription.Name = “description”;
    mDescription.Content = sDescription;
    Header.Controls.Add(mDescription);
}