Search code examples
asp.netsystem.websystem.web.routing

BC30451: Name 'RouteTable' is not declared


I'm trying out some URL rewriting within my global.asax - similar to what's going on in this microsoft article http://msdn.microsoft.com/en-us/library/system.web.routing.routetable.routes.aspx

I'm keep getting the error "BC30451: Name 'RouteTable' is not declared."

I have imported the following into the global.asax file:

<%@ Import Namespace="System.Web.Routing" %>
<%@ Import Namespace="System.Web.Routing.Route" %>
<%@ Import Namespace="System.Web" %>


Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)

    RegisterRoutes(RouteTable.Routes) ' the problem occurs here

End Sub

..but it doesn't seem to recognise "RouteTable".

I have checked with my hosting providers that I am on .net 3.5 - although I'm not convinced as at the bottom of the error message says:

Version Information: Microsoft .NET Framework Version:2.0.50727.4234; ASP.NET Version:2.0.50727.4223

They told me :

We have receive an update from our system engineers, net 3.5 is basically version 2 with a few add -ons. Similarly 4.5 is references as version 4.
They have also checked other sites on the server and they are also reflected as 2

Is this correct as I'm not sure if I can do this and not be on 3.5?

Thanks,


Solution

  • Ok, it would appear that even though Microsoft .NET Framework Version:2.0.50727.4234; might appear on screen, version asp.net 3.5 could still be installed. I've checked out a few sources online, including this "asp.net version madness" :

    http://blogs.msdn.com/b/jamesche/archive/2007/09/25/asp-net-version-madness.aspx

    So I don't believe the error is now caused by running a lower version.

    As for the error I'm getting, I think I need to add this to my web.config:

        <add assembly="System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>