ASP.NET Routing gives 404 error

I really like the new .NET 4 (3.5) routing, it is very simple and straight forward to implement – just add some MapPageRoute to your global.asax and then some RouteData.Values to your aspx files 🙂

Anyway it was simple until last night when I was adding routing to an old VB.NET WebSite project. I just could not get it to work, I kept getting HTTP 404 errors:

Error Summary
HTTP Error 404.0 – Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

Detailed Error Information
Module IIS Web Core
Notification MapRequestHandler
Handler StaticFile
Error Code 0x80070002

Finally I figured out that I had some stuff missing in my web.config to get this to work, ie making sure the routing module runs.
<remove name="UrlRoutingModule-4.0" />
<add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="" />

or use this:

<modules runAllManagedModulesForAllRequests="true"/>
This is probably not a problem for new projects created in Visual Studio 2010 but obviously my old web.config needed some fixing.

Thanks to this blog post by Ashic Mahtab.

Filter by Label in Gmail

I have just started playing around with Filters in Gmail. This is one thing that took me some time to figure out, how to filter by label. It turns out it was quite easy, it seems you can use any search string in the “Has the words” field of your filter. To get a label you simply put “label:your-label-name” in there.

You will get a warning: “Warning: Filter searches containing “label:”, “in:”, or “is:” criteria are not recommended, as these criteria will never match incoming mail.”
I think this makes sense as incoming email would not have a label.

More Gmail search options can be found here