I would like to map the URL http://localhost:49930/upload -
RouteConfig.cs-
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional },
namespaces: new[] { "BrSupervisorTracker.Controllers" }
);
routes.MapRoute(
name: "ExcelUploader",
url: "upload/{controller}/{action}/{id}",
defaults: new { controller = "FileUpload", action = "Index", id = UrlParameter.Optional },
namespaces: new[] { "BrSupervisorTracker.Controllers" }
);
}
}
Controller-
public class FileUploadController : Controller
{
public ActionResult Index()
{
return View("ExcelUpload");
}
}
But it's not working. Returns HTTP 404. Any help?
ExcelUploaderroute before the default and change the url tourl: "upload",(remove the/{controller}/{action}/{id})