Hi, I need help. I can't access my portable area from my main project. I build everything and I get a 404 error when trying to access this portable area (localhost:123/IW/Home), but all my regular areas are working fine (ex: localhost:123/Portal/Home)
Here's what I did in order to install my portable area -I downloaded MVCContrib -I added reference to MVCContrib.dll in my main project (called WAB)
-I created a new Class Librairy project in the same solution as WAB. -This new Class Librairy is called IWPortableArea and I added the necessary assemblies references (MVCContrib, System.mvc, ...)
-I created a IWRegistration:
namespace IWPortableArea
{
public class IWRegistration : PortableAreaRegistration
{
public override void RegisterArea(System.Web.Mvc.AreaRegistrationContext context, IApplicationBus bus)
{
context.MapRoute(
"iw",
"iw/{controller}.aspx/{action}",
new { controller = "login", action = "index" });
RegisterAllAreas(GetType());
}
public override string AreaName
{
get { return "iw"; }
}
}
}
-I created a simple controller that's not making use of any view file:
namespace IWPortableArea.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
return Content("yo you are in IW Portable Area, congrats");
}
}
}
-I added a reference in my main project to the portable area: IWPortableArea.dll
-Finally I modified the Global.asax.cs of my main application to:
public class MvcApplication : System.Web.HttpApplication
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}.aspx/{action}/{id}", // URL with parameters
new { controller = "Portal", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
}
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
RegisterRoutes(RouteTable.Routes);
}
}