Last post Jan 02, 2011 04:40 AM by NetSpike
Jan 01, 2011 11:20 AM|NetSpike|LINK
I've been reading many articles and can't seem to get my ASP.NET 4 web forms project to do Routing/URL rewriting.
I have added the following reference to the ASP.NET project:
It then added the following line to the web.config file:
<compilation debug="false" targetFramework="4.0"> <assemblies> <add assembly="System.Web.Routing, Version=188.8.131.52, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
In the global.asax file I want to add the routes, but it is not recognising RouteTable and RouteCollection keywords.
How do I get these to be recognised so that I can create the rules in the global.asax file?
Thanks in advance!
Jan 02, 2011 01:44 AM|vijaypant|LINK
Hi, this plumbing work of adding dll reference and namespaces are automatically done by the visual studio 2010 ide, then why you are doing this manually? Normally, this should be already available to you in asp.net web site project.
Jan 02, 2011 02:58 AM|naveenj|LINK
but it is not recognising RouteTable and RouteCollection keywords.
Are you sure you have added the namespace
Also try this at Global.asax. Key in RouteTable and then single click on it with mouse.
Then press CNTRL key and holdijng it press .(dot) and
see what the Visual Studio intellisense is offering you.
Jan 02, 2011 04:40 AM|NetSpike|LINK
Thanks for your help.
Came accross this link (although it's for Visual Studio 2008):
They mentioned to add this to the Global.asax file:
<%@ Import Namespace="System.Web.Routing" %>
It now works.