0

I'm using this package which I installed from NuGet.

I've got a method that looks like this:

[GET("StreamFile/{filename}")]
public FileStreamResult StreamImageByFileName(string filename)

Which I reference like this:

<img src="@Url.Action("StreamImageByFileName", new{filename=item.ThumbFile})" />

Which comes out like this:

<img src="/StreamFile/3hg7p1wr_wjtkpn8-g80heh3f.jpg" />

But it never makes it into my method, and always returns 404s.

Why? It's reversing the URL correctly, so why won't it match when it makes a request to it?

mpen
  • 272,448
  • 266
  • 850
  • 1,236
  • Your code should work... I was not able to repro your issue in an empty mvc project. Have you called `routes.MapAttributeRoutes();`? Maybe you have an another routing/handler/filter which triggers on the `.jpg` extension... – nemesv Sep 08 '12 at 08:07
  • @nemesv: I put a breakpoint on `routes.MapAttributeRoutes()` -- it's definitely called. I do still have the default routes in my project though, `routes.IgnoreRoute("{resource}.axd/{*pathInfo}");` and `url: "{controller}/{action}/{id}",` -- I wanted to keep that last one as a fall back. You think it's tripping it up? Edit: Took out that default route..same issue. – mpen Sep 08 '12 at 08:57
  • I've also kept the default routes... so I guess your problem is somewhere else. Do you use AttributeRouting on other actions? Is it working there? – nemesv Sep 08 '12 at 09:05
  • @nemesv: Yes, it seems to work fine with integer ID's, just can't seem to get it work with strings. – mpen Sep 08 '12 at 16:05
  • Which webserver do you use? VS Dev server, IIS express, IIS? – nemesv Sep 08 '12 at 17:47
  • @nemesv: IIS Express; the one that came with VS2012. – mpen Sep 08 '12 at 17:55

0 Answers0