Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.net MVC 3 route for jpg files

I have an MVC 3 application with this route in global.asax

routes.MapRoute(
            "ProfilePictureSmall",                             // Route name
            "small/{PictureID}.jpg",                           // URL with parameters
            new { controller = "Picture", action = "Show", Size = "small", PictureID = Guid.Empty }  // Parameter defaults
        );

And this is the action from my controller

public ActionResult Show(string Size, Guid PictureID)

This route isn't working on my computer but it works on other local computers and test servers and live servers. It used to work on my PC as well, but I recently reinstalled my system so I assume it has something to do with this.

Does anyone have any ideas?

PS: All other routes work fine. This one also works if I remove .jpg

like image 807
Mihai Avatar asked Nov 27 '12 15:11

Mihai


1 Answers

For me, adding this line to web.config inside system.webServer

<modules runAllManagedModulesForAllRequests="true" />

fixed it.

Btw. I'm using .Net MVC 4.0

Source

like image 87
BjarkeCK Avatar answered Oct 07 '22 22:10

BjarkeCK