Footer I searched for a long time for a simple CSS solution to the eternal "sticky footer" problem, where the footer goes down to the end of the page. Up to now I have resorted to JavaScript to achieve this, which is not really the most elegant solution. It should be simple, right?

The other day, I stumbled upon what looked like a basic HTML/CSS solution. I wanted CSS that would push the footer to the bottom of the page, irrespective of content height, in an ASP.NET Master Page setup. Thanks to Ryan Fait for this.

It was straightforward enough to get it working for IE7. Firefox 3.0 didn't play nice at first until I moved the wrapper and footer divs out to the master page. Feel free to download the sample below and try it out for yourself - VS 2008 solution. Ignore the red wigglies in the master page. It has been tested in IE7, Firefox 3.0 and Chrome (19.91 kb)


With master pages you need to take account of the "form" element by  including it in the appropriate CSS selector.

Tags: ,


HTML Markup I don't know about you, but as a Web Developer I sometimes find myself not doing the things I should be doing. The recent rash of SQL Injection script attacks have shown me personally how little thought I sometimes give to where the input is coming from when I'm developing forms.

Then there is the generated markup itself. All our development efforts end up in plain HTML being spit out onto a'page' on a device of some kind. When you consider how sensitive the search bots are to the structure, content and placement of our markup, isn't it amazing that the only time we ever think of it is when we have to generate it dynamically in some code-behind? :-O

If you are using master pages, then you won't want to have duplicate content, in the shape of similar meta tag content, all over your site. So, you will have to generate the meta tags programmatically in the code-behind of the content pages:

HtmlHead head = this.Master.Page.Header;
HtmlMeta meta = new HtmlMeta();
meta.Name = "Description";
meta.Content = "Friendly and relevant content";


You also do not want pages in the secure area of your site to be spidered:

HtmlHead head = this.Master.Page.Header;
HtmlMeta meta = new HtmlMeta();
meta.Name = "googlebot";
meta.Content = "noindex, nofollow";


I recently noticed a big chunk of JavaScript in the markup that I was using to solve the problem of pushing the footer to the bottom of the page, and not relying on copious amounts of needless content and spacers to do the job that CSS cannot. I should have had it in an external file and used the appropiate ASP.NET method to register it and pull it in. So, I created a JS file called footerFix.js, placed it in its own folder and used the following in the master page code-behind:

string myScript = "/js/footerFix.js";
Page.ClientScript.RegisterClientScriptInclude("myKey", myScript);


This created the following markup in my page:

<script src="/js/footerFix.js" type="text/javascript"></script>


Now I have a smaller page, faster download time and a fairly good chance of the spiders actually getting the info they require.


You've checked your namespaces and references a hundred times but you're still getting this annoying error when accessing code files in a sub-folder?

Are you Missing an Assembly Reference?


There is more than one cause of this error, for example, you will sometimes see it when attempting to use the App_Code folder within an ASP.NET 2.0 Web Application project.

On this particular occassion, we are building an ASP.NET 2.0 Web Application project in C# using VS 2005. The folder containing the code file is just a regular folder, but the same error message appears.

Here's a fix that might work for you. Right-click the file you are trying to access in Solution Explorer.

File Properties in Solution Explorer


Select Properties which will open the Properties window. Go to the Build Action DropDown menu.

File Build Action


Select 'Compile' for the build action. In this case, it had been to be set to 'Content'. Now compile as normal and you should be able to reference the file.