Prev: ModalPopupExtender and Required Field Validator
Next: Unable to retrieve folder information from the server
From: Stephen Handley on 20 Aug 2010 18:59 If anyone can help me on this it would be appreciated -it's driving me mad... I'm (trying) to implement asp.net web routing on an existing website I have to update (web forms framework 3.5). I've followed http://msdn.microsoft.com/en-us/magazine/dd347546.aspx to the letter and very good it is too, but it's not working. I've added all the routing content to the web.config. I've added a global.asax, added a RegisterRoutes method to update the RouteTable.Routes collection with my custom route handler which implements the IRouteHandler interface. Obviously, therefore my custom route handler implements the interface (the single method GetHttpHandler returns IHttpHandler). I step through the code, the route is added through the Application_Startup event handler; I know the route has been added to the RouteTable.Routes collection. The problem is that the custom route handler's GetHttpHandler method doesn't fire when I enter a url that matches the pattern that should invoke it. All I get is a 404. I step through code with breakpoints in the GetHttpHandler method and it never hits this code when the url should cause the method fire and return my actual page. To test that 1.) I did the setup correctly, and 2.) that it's not my pc, I created a brand new asp.net web forms website from scratch with 2 pages, did the same setup and it worked first time - the GetHttpHandler fired and returned a page implementing the IHttpHandler interface no problem. (I'm running 64-bit Windows 7, VS2010). So, I know there are no problems with the setup of my machine, or following the instructions to configure web routing. The site I'm modifying is using the AJAX control toolkit, and I wondered if this might in someway affect things, so got that running on the brand new test site and it still worked - it had no detrimental affect. Next, I copied and swapped the web.config of the two sites (the 'real' site and the brand new 'dummy') and yet again it made no difference - the brand new one still worked and the 'real' site did not. I've rebuild the site I've got to update and the build completes every time with no problems whatsoever. I'm running out of ideas so if anyone has come across this problem and has the answer I'd be truly grateful. Thanks Ste |