Simple ASP.NET SEO Enhancement

As many people have mentioned one of the most important (and easy) SEO related enhancements you can make to your site is to use a unique title and meta description on each page.

In ASP.NET 2.0 the page title is easily set either via either the title attribute of the page directive in the markup, or by setting it directly in code e.g

this.Title = “my unique title”;

Creating a unique meta description is slightly more involved but still pretty straight forward.

HtmlMeta metaDescription = new HtmlMeta();
metaDescription.Name = “description”;
metaDescription.Content = “my unique description”;
this.Header.Controls.Add(metaDescription);

These are two of the simplest and quickest SEO related enhancements you can make to your ASP.NET site – you’ve really got no excuse not to!

How good is your content?

The market I am planning to play in is geographically constrained. Because of this there aren’t many competitors at this stage in the game which, initially you would think is a good thing. However this particular market can only support a small number of players, and because there are already established businesses operating and building brand recognition it will make my job as an SEO all that more difficult, but subsequently much more important.

I firmly believe that the defining factor will be the quality of the content provided. The value the customer perceives they are receiving by using one site vs another will ultimately dictate where their brand loyalty lies. Rand covers this quite well in this video.

Something web users are slowly coming to realise is that most markets are flooded with poor quality copies and once you find a site that produces quality content in the area you are interested in you stick with it.

SEO Newbie

I have a new super secret project I am working on and as a result I am learning a great deal of new skills. It is a web based project and to that end I have started reading up on SEO (Search Engine Optimisation) with a view to applying these new skills in the near future.

The first thing that strikes you as a SEO newbie is where do I start? There seems to be a mountain of information out on the web, but as always sorting the wheat from the chaff is not easy. Also, a lot of the blogs assume quite a bit of domain knowledge. There don’t seem to be too many people answering the really simple questions like “what exactly is a keyword?” and what does SERP stand for? (Search Engine Results Page by the way).

To that end I am going to start posting any little tid bits of information that I think might be useful to a real SEO newbie in the hope that I might help someone short cut the whole process somewhat. To start off with, here is a list of blogs that I’ve found to be really useful and contain well written and insightful content:

Lots more to come on this topic, and hopefully I’ll be able to provide some insight on SEO considerations specific to ASP.NET development soon.

Finally got my patch committed!

I’m stoked. With the release of MonoDevelop 0.14 my class and member selectors are finally in the core MonoDevelop. I know it’s only a small contribution, but personally it’s a feature I find very useful so I hope other people are deriving some benefit from that work too. I do notice that most of the screen shots of MD I see have them enabled so I guess it’s not annoying people enough to turn it off!

Anyway, here is my little claim to fame:
http://www.monodevelop.com/Release_notes_for_MonoDevelop_0.14

Ndbunit is great – once you get past the pain

Over the last few days I’ve been setting up my latest project to use Ndbunit to initialise the database to known state prior to running each of my unit tests. It has been a bit of painful process as the documentation is fairly minmal and non-existant for some features, but I think I’ve got there now.

A couple of things I wanted to put down here in case I ever forget them and start banging my head on the desk again!

Firstly if you want to use the InsertIdentity method you need to make sure your xsd sets the AutoIncrement attribute to true for your identity column. eg.

<xs:element autoincrement=”true” type=”xs:int” name=”PERSON_ID”>

Secondly if you want to insert more than one row into a table you need to make sure your xsd sets the IsDataSet attribute to true e.g

<xs:element name=”PERSON” isdataset=”true”>

subversion 1.4.3 on ubuntu Edgy amd64

Just went through a few dramas tonight to upgrade svn on my system from the old 1.3.2 version that is in the ubuntu repos to the latest 1.4.3.

I found this howto which gets you almost all the way there. Unfortunately amd64 uses will get a link error complaining that libneon.a needs to be compiled with the fPIC flag. This is easily fixed by changing the following line in neon/src/Makefile (line 28) after the configure step from this
CFLAGS = -g -O2
to
CFLAGS = -g -O2 -fPIC

then you make and install as per the howto.

HTH!

Cool open source .NET charting component

I’ve been looking around for a decent free (as in beer) .NET charting component that I can use from ASP.NET for my current website project. At first I tried WebChart, but it didn’t seem to want to work under mono. I could have probably figured out the problem with a little bit of effort, but I’ve got better things to spend my time on at the moment. So a little more digging and a search of the Mono mailing list uncovered zedgraph. This component is awesome. Take a look at some of the sample graphs – it produces really professional looking results.

Now I haven’t delved into the guts of it yet, that’s tonight’s task, but I just wanted to let people know it’s out there.

A fun weekend.

Well another work week has begun but I had quite a fun weekend so am OK about getting stuck back into it at work. On Friday night Bruce and I watched Alien and Aliens back to back. These are possibly two of the greatest Sci-fi movies ever made. We did Aliens 3 on Saturday night, but didn’t quite manage to complete the set. Well, I guess there’s always next weekend for the Resurrection!

On Sunday afternoon Anthea and I visited the London Zoo. Now I’m a firm believer that Zoo’s not only have their place but are absolutely essential to the continued existence of so many of the wonderful creatures on this planet. It was great to see the breding programmes are having a positive impact and are literally bring a number of the species that I saw back from the very edge of extinction. Hopefully one day those species will thrive in the wild again, but for that to happen their natural habitats must first be protected from deforestation and poaching. I took a few photos although I didn’t have time to look at any of them last night. I might post a couple here if any of them turned out OK.

HttpHandlers and session state

While hacking on my website the other night I found a need to build an HttpHandler (actually a page would have worked fine, but a httphandler was more elegant). I got part way through debugging when I found that session state wasn’t available in an HttpHandler! This caused me some consternation as I have an HttpModule which I use to retrieve my nhibernate session during the execution of a request and it stores the nhibernate session in the HttpContext session (hopefully that’s not too many sessions and you’re still with me).

Anyway I almost re-engineered the handler to work another way when a search of google groups revealed this simple solution, your handler simply has to “implement” the empty IRequiresSessionState interface (you’ll need to be using the System.Web.WebSessionState namespace.) e.g.

public class VerificationHttpHandler : IHttpHandler, IRequiresSessionState

That’s it, you now have http session available in your handler.

nhibernate – a complex beast

I am beginning to discover that nHibernate is a far more complex beast than I realised. Over the last couple of days I’ve spent some more time reading the documentation (out of necessity rather than pure interest) and it is capable of some amazing things, however this flexiblity comes at the cost of complexity (as is often the case).

Here’s an example of a trap for young players that caught me the other night. I have two entities A & B that map two two underlying tables tableA and tableB. The primary key of tableA is a foreign key in tableB. tableA contains a property Rating1Count which is the count of a column in tableB. I had code similar to the following:

ISession session = NHibernateHttpModule.CurrentSession;
ITransaction transaction = session.BeginTransaction();
try
{
    log.Debug(“Saving new B”);
    session.SaveOrUpdate(b);

    log.Debug(“saved new B”);
    ICriteria crit = session.CreateCriteria(typeof(A));
    crit.Add( Expression.Eq(“AId”, a.AId) );
    log.Debug(“Executing query”);
    IList As = crit.List();
    if (As.Count == 1)
    {
        a = As[0] as A;
        log.Debug(string.Format(“Count of 1s in tableB {0}”, a.Rating1Count));
    }
    transaction.Commit
}

After testing this I found that even though my changes were being persisted to tableB (verified by querying mysql directly) they weren’t reflected in my tableA object.

Then it dawned on me, at what point does nhibernate write the changes to the database? I moved the transaction.Commit line up to be directly below the call to SaveOrUpdate and lowe and behold it works!

In hindsight it’s obvious, but it had me scratching my head for a while (and it was late – at least that’s my story and I’m sticking to it!).