0

In my site i have the following routing table:

routes.MapRoute("Something",
                "sites/{company}/{site}/",
                new { controller = "Home", action = "LoadClientSite" },
                new[] { "CorrectOnLine.Controllers" });

routes.MapRoute("Default1", // Route name
                "{company}/{site}/", // URL with parameters
                new { controller = "Home", action = "DefaultRedirect" },
                new[] { "CorrectOnLine.Controllers" }
            );

routes.MapRoute("Default2", // Route name
                "{company}/{site}/{id}", // URL with parameters
                new { controller = "Home", action = "DefaultRedirect" },
                new[] { "CorrectOnLine.Controllers" }
            );

I am using the following link to call an action:

@(Html.Action("index", "home", new { area = "ClientsSites", CompanyID = Model.CompanyID, SiteID = Model.SiteID, CategoryID = Model.CategoryID, Message = Model.Message }))

In the view i have an image:

<img alt="" src="../../../../../WareHouse/Sites/logo_site_@(Model.Site.SiteID).jpg" height="250px" width="750px" />

The problem is that when the image loades MVC tries to locate the image src in the routing table , conntroller = WareHouse, action = Sites.

How can i make MVC to only load the iamge and not try to load it as a view?

Thanks, Alex

1 Answers1

0

You could ignore route for all paths that end in the .jpg extension...

routes.IgnoreRoute("{*alljpeg}", new {alljpeg=@".*\.jpg(/.*)?"});
Chris Pont
  • 789
  • 5
  • 14