0

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,

thegunner
  • 6,883
  • 30
  • 94
  • 143
  • Here is a link to help you check what version of the framework you have: http://stackoverflow.com/questions/199080/how-to-detect-what-net-framework-versions-and-service-packs-are-installed – chris_dotnet Jun 11 '13 at 15:51
  • Thanks, unfortunately I just have access to an FTP folder to send my files to - I don't get access to or can't remote desktop to a server to check. – thegunner Jun 11 '13 at 16:05
  • I posted some code in an answer below that you can use on your page to find your version even with just FTP access. – chris_dotnet Jun 11 '13 at 17:02
  • I've tried Response.Write("The .NET version is " & System.Environment.Version.ToString()) ...which says The .NET version is "2.0.50727.4234" ?!? Could this possible by 3.5 like the hosting company are saying? – thegunner Jun 11 '13 at 23:19
  • I posted new code that should help you find the exact version number. Basically you can get it with: System.Environment.Version.ToString() – chris_dotnet Jun 12 '13 at 15:34

2 Answers2

1

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"/>
thegunner
  • 6,883
  • 30
  • 94
  • 143
0

You must be running 3.5 SP1 or later to use RouteTable. I believe that routing wasn't available in 3.5 before Service Pack 1, so I would recommend verifying that you are on at least 3.5 SP1.

The System.Environment.Version will get you this information so you you can try this to check your .net version number like so in your code behind:

Response.Write(System.Environment.Version.ToString());
Response.End();

Or in your aspx page:

<% Response.Write("Version: " + System.Environment.Version.ToString() ) %>
chris_dotnet
  • 844
  • 9
  • 14
  • Ok, couldn't get that to work. I've tried Response.Write("
    The .NET version is " & System.Environment.Version.ToString() & "
    ") ...which says The .NET version is "2.0.50727.4234" ?!? Could this possible by 3.5 like the hosting company are saying?
    – thegunner Jun 11 '13 at 23:17
  • I posted new code that should help you find the exact version number. Basically you can get it with: System.Environment.Version.ToString() – chris_dotnet Jun 12 '13 at 15:33