locked
Custom Route Handler in ASP.NET 4.5 RRS feed

  • Question

  • User1253227861 posted

    I am migrating a site to ASP.NET 4.5. My images/css are in a custom folder. I added a route to the global.asax:

    routes.Add("ImagesRoute", new Route("/images/{filename}", new ImageRouteHandler()));

    This is not triggered anymore in ASP.NET 4.5 (working on ASP.NET 4.0). I found a explanation from somebody at microsoft on another website.

    This is likely due to the change to the ASP.NET 4.5 project templates to not include the IIS setting that enables RAMMFAR (Run All Managed Modules For All Requests). This setting is in the system.webServer element of the web.config file. When running on the latest versions of IIS or IIS Express, RAMMFAR is only required for advanced scenarios such as the one described in this issue, and has a throughput overhead on static file serving if enabled, so we chose to remove the setting for new 4.0/4.5 projects in VS11. we are currently reviewing the issue you have submitted.

    http://connect.microsoft.com/VisualStudio/feedback/details/728086/custom-route-handler-in-asp-net-4-5-that-maps-to-image-no-longer-works

    The reply is from march, no follow-up provided there.
    This is a major blocking issue for me. Anybody knows a solution to this? or how I should handle a custom route handler?

    Thanks.

    Rick

    Saturday, October 6, 2012 7:57 AM

All replies

  • User863160722 posted

    Have you tried setting the RAMMFAR attribute to true?

    <system.webServer>
       <modules runAllManagedModulesForAllRequests="true" />
    </system.webServer>

    Monday, October 8, 2012 3:47 PM
  • User1253227861 posted

    Hi Sorry for the late reply, yest did put RAMMFAR back, that should do the trick but no success.

    Now I am trying fixing it with a httphandler but seems nothing in my system.webserver is triggered (while its the correct web.config).
    I upgraded to VS2012 created a MVC4 project, and copied my MVC3 files, should work.

    Still no clue. keep you posted :)

    Wednesday, October 10, 2012 3:11 PM
  • User-236004499 posted

    Hi,

    Is you registering routing code in Global.ascx file inside the appstart()? If yes and your website on server then you need to restart application pool to read once so application add entries into the routing table.

    Regards

    Pratik

    Wednesday, November 21, 2012 7:37 PM