Note that there are some explanatory texts on larger screens.

plurals
  1. POPortable Area not finding embedded files MVC4 C#
    primarykey
    data
    text
    <p>I have a solution with two projects in it. A portable areas project, and a web site that references the portable areas project, and Both reference MvcContrib.</p> <p>The problem I am have is with the embedded resources, they are giving me a 404 error when I try to get to them. It seems like it's trying to access a physical path not the dll. The partial view works fine.</p> <p>The file I'm trying to access looks like this inside my visual studio solution explorer</p> <p>AdHocReporting/Areas/AdHocReportBuilder/Content/adhoc.css (the build action is embedded)</p> <p><strong>Here is the routing for the portable area:</strong></p> <pre><code>using System.Web.Mvc; using MvcContrib.PortableAreas; namespace AdHocReporting.Areas.AdHocReportBuilder { public class AdHocReportBuilderAreaRegistration : PortableAreaRegistration { public override string AreaName { get { return "AdHocReportBuilder"; } } public override void RegisterArea(AreaRegistrationContext context, IApplicationBus bus) { RegisterRoutes(context); RegisterAreaEmbeddedResources(); } private void RegisterRoutes(AreaRegistrationContext context) { context.MapRoute( AreaName + "_content", base.AreaRoutePrefix + "/Content/{resourceName}", new { controller = "EmbeddedResource", action = "Index", resourcePath = "Content" }, new[] { "MvcContrib.PortableAreas" } ); context.MapRoute( AreaName + "_default", base.AreaRoutePrefix + "/{controller}/{action}/{id}", new { action = "Index", id = UrlParameter.Optional } ); } } } </code></pre> <p><strong>Here is the Web sites Global.aspx that has the reference to the portable area</strong></p> <pre><code>namespace AdHocReportingSite { public class MvcApplication : System.Web.HttpApplication { public static void RegisterGlobalFilters(GlobalFilterCollection filters) { filters.Add(new HandleErrorAttribute()); } public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults ); } protected void Application_Start() { AreaRegistration.RegisterAllAreas(); PortableAreaRegistration.RegisterEmbeddedViewEngine(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); } } } </code></pre> <p><strong>here is an image of what my solution explore looks like:</strong></p> <p><img src="https://i.stack.imgur.com/6P0TK.png" alt="Solution Explorer"></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload