These forums are read-only and considered to be an archive. Please use the new Community for future interaction and posts.

FileUltimate Errors with ASP.Net MVC (4.0)

Hello,

I am trying to use FileUltimate with MVC (4.0) and I am having a very interesting issue coming up.

The problem starts when referencing the GleamTech.FileUltimate.dll library to my project; it seems to take over the routing for POST requests, a simple post to  /Controller/Action becomes something like /Resource.ashx?_action=action&_controller=controller.

ASP.Net throws the following error:

Resource request is in invalid format, the correct format is /resource.ashx/[ResourceTime]/[ResourceIdentifier] where [ResourceTime] is a number representing last modified time and [ResourceIdentifier] identifies a combined resource or a single assembly resource in [ResourceStoreKey]/[Folder1]/[Folder2]/[FileName] format.


So my question is; is there any known workaround for this? Is there a known compatibility error between versions?

Any guidance on this matter would be greatly appreciated.

Best,
-Ricardo
Ricardo 7/23/2013 8:35 AM
Hi,
The problem is with URLs generated by Html.ActionLink helper methods. When you reference FileUltimate, it automatically adds its routes to the application's route table at the top. Html.ActionLink detects FileUltimate as the first maching route and generates a wrong URL. You should use Html.RouteLink helper method instead because it allows you to specify the route name explicitly and you will always get the correct URL.

For instance, you should change links like this in your cshtml files:

@Html.ActionLink("About", "About", "Home")

to this:

@Html.RouteLink("About", "Default", new {controller = "Home", action="About"})

Assuming you define the route as follows in RouteConfig.cs:

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            );

I have created a MVC 4 project with "Internet Application" template to test it and it works.
Unfortunately changing the links is the best method to make FileUltimate work with MVC.
I have tried clearing the route table and adding FileUltimate routes after the applications's routes in RouteConfig.cs and correct URLs are generated but this time FileUltimate does not work properly (HTTP 404 error when browsing folders).
Cem Alacayir 7/30/2013 2:28 PM
Thanks for the reply; is very useful to know.

Ricardo 7/30/2013 8:39 PM